威廉·柯林斯
William Collins
哈珀柯林斯出版社旗下品牌
An imprint of HarperCollinsPublishers
伦敦桥街1号
1 London Bridge Street
伦敦 SE1 9GF
London SE1 9GF
这本电子书由威廉·柯林斯于 2016 年在英国首次出版
This eBook first published in Great Britain by William Collins in 2016
2016 年由 Henry Holt and Company, LLC 在美国首次出版
First published in the United States by Henry Holt and Company, LLC in 2016
版权所有 © 2016 Brian Christian 和 Tom Griffiths
Copyright © 2016 by Brian Christian and Tom Griffiths
Brian Christian 和 Tom Griffiths 主张道德权利
Brian Christian and Tom Griffiths assert the moral right
被认定为该作品的作者
to be identified as the authors of this work
这本书的目录记录是
A catalogue record for this book is
可从大英图书馆获取
available from the British Library
根据国际和泛美版权公约保留所有权利。支付所需费用后,您即被授予非排他性、不可转让的权利,可在屏幕上访问和阅读本电子书的文本。未经哈珀柯林斯明确书面许可,不得以任何形式或任何手段(无论是电子的还是机械的,无论是已知还是未来发明的)复制、传播、下载、反编译、反向工程或存储或引入任何信息存储和检索系统。
All rights reserved under International and Pan-American Copyright Conventions. By payment of the required fees, you have been granted the non-exclusive, non-transferable right to access and read the text of this e-book on screen. No part of this text may be reproduced, transmitted, down-loaded, decompiled, reverse engineered, or stored in or introduced into any information storage and retrieval system, in any form or by any means, whether electronic or mechanical, now known or hereinafter invented, without the express written permission of HarperCollins.
来源 ISBN:9780008166090
Source ISBN: 9780008166090
电子书版本 © 2016 年 4 月 ISBN:9780007547982
Ebook Edition © April 2016 ISBN: 9780007547982
版本:2016-04-05
Version: 2016-04-05
内容
Contents
想象一下,你正在旧金山找公寓——旧金山可以说是美国找公寓最让人头疼的城市。蓬勃发展的科技行业和严格的新房分区法规,共同作用,使得旧金山的房价与纽约不相上下,而且据许多人说,竞争更加激烈。新房源几分钟内就挂牌出售,开放参观的房屋也人山人海,钥匙往往落入那些能先把押金支票塞给房东的人手中。
Imagine you’re searching for an apartment in San Francisco—arguably the most harrowing American city in which to do so. The booming tech sector and tight zoning laws limiting new construction have conspired to make the city just as expensive as New York, and by many accounts more competitive. New listings go up and come down within minutes, open houses are mobbed, and often the keys end up in the hands of whoever can physically foist a deposit check on the landlord first.
如此残酷的市场几乎无法提供理性消费者应有的理性调查和深思熟虑。不同于商场顾客或网购者,他们可以在做决定之前比较各种选择,而旧金山的潜在买家则必须立即做出决定:要么放弃所有其他选择,选择你正在看的公寓;要么一走了之,永不回头。
Such a savage market leaves little room for the kind of fact-finding and deliberation that is theoretically supposed to characterize the doings of the rational consumer. Unlike, say, a mall patron or an online shopper, who can compare options before making a decision, the would-be San Franciscan has to decide instantly either way: you can take the apartment you are currently looking at, forsaking all others, or you can walk away, never to return.
为了简单起见,我们假设你只关心如何最大限度地获得最好的公寓。你的目标是将“错失良机”和“未尽之事”这两大遗憾——“斯库拉与卡律布狄斯”——降到最低。你立刻就会陷入一个困境:除非你有一个基准来判断,否则你怎么知道一套公寓确实是最好的?而除非你考察(并失去)了多套公寓,否则你又如何确定这个基准呢?你收集的信息越多,你就越容易在看到合适的机会时发现它——但你也更有可能已经错过了。
Let’s assume for a moment, for the sake of simplicity, that you care only about maximizing your chance of getting the very best apartment available. Your goal is reducing the twin, Scylla-and-Charybdis regrets of the “one that got away” and the “stone left unturned” to the absolute minimum. You run into a dilemma right off the bat: How are you to know that an apartment is indeed the best unless you have a baseline to judge it by? And how are you to establish that baseline unless you look at (and lose) a number of apartments? The more information you gather, the better you’ll know the right opportunity when you see it—but the more likely you are to have already passed it by.
那么你该怎么办?当告知真相本身就危及最终结果时,你该如何做出明智的决定?这是一个残酷的局面,近乎悖论。
So what do you do? How do you make an informed decision when the very act of informing it jeopardizes the outcome? It’s a cruel situation, bordering on paradox.
面对这类问题,大多数人会本能地认为,这需要在“看房”和“跳房”之间取得某种平衡——你必须看足够多的房源,确定一个标准,然后选出符合你既定标准的房源。事实上,这种平衡的概念完全正确。但大多数人并不确定这种平衡究竟是什么。幸运的是,答案是肯定的。
When presented with this kind of problem, most people will intuitively say something to the effect that it requires some sort of balance between looking and leaping—that you must look at enough apartments to establish a standard, then take whatever satisfies the standard you’ve established. This notion of balance is, in fact, precisely correct. What most people don’t say with any certainty is what that balance is. Fortunately, there’s an answer.
百分之三十七。
Thirty-seven percent.
如果你想最大限度地提高找到理想公寓的几率,那就花37%的找房时间(如果你给自己一个月的时间,那就11天)来不慌不忙地探索各种选择。把支票簿留在家里;你只是在调整。但之后,准备好立即付清押金,买下你看到的第一个比你之前看过的任何房子都好的房子。这不仅仅是在“看”和“跳”之间做出的直觉上令人满意的妥协。这是可证明的最佳解决方案。
If you want the best odds of getting the best apartment, spend 37% of your apartment hunt (eleven days, if you’ve given yourself a month for the search) noncommittally exploring options. Leave the checkbook at home; you’re just calibrating. But after that point, be prepared to immediately commit—deposit and all—to the very first place you see that beats whatever you’ve already seen. This is not merely an intuitively satisfying compromise between looking and leaping. It is the provably optimal solution.
我们之所以知道这一点,是因为找房子属于一类被称为“最优停止”问题的数学问题。37% 规则定义了一系列简单的步骤——计算机科学家称之为“算法”——来解决这些问题。事实证明,找房子只是最优停止在日常生活中出现的方式之一。做出或放弃一系列选择是一种在生活中反复出现的结构,只是形式略有不同。在把车停进停车位之前,要绕街区多少圈?在套现之前,要把运气放在高风险的商业投资上多远?为了得到更好的房子或汽车报价,要等多久?
We know this because finding an apartment belongs to a class of mathematical problems known as “optimal stopping” problems. The 37% rule defines a simple series of steps—what computer scientists call an “algorithm”—for solving these problems. And as it turns out, apartment hunting is just one of the ways that optimal stopping rears its head in daily life. Committing to or forgoing a succession of options is a structure that appears in life again and again, in slightly different incarnations. How many times to circle the block before pulling into a parking space? How far to push your luck with a risky business venture before cashing out? How long to hold out for a better offer on that house or car?
同样的挑战也出现在一个更加棘手的场景中:约会。最佳停止是连续一夫一妻制的科学。
The same challenge also appears in an even more fraught setting: dating. Optimal stopping is the science of serial monogamy.
简单的算法不仅能解决找公寓的问题,还能解决生活中所有遇到最佳停车问题的情形。人们每天都在努力应对这些问题——尽管诗人们描写求爱的苦恼肯定比描写停车的苦恼要多——而且在某些情况下,他们为此承受着巨大的痛苦。但这种痛苦是不必要的。至少从数学上来说,这些问题已经解决了。
Simple algorithms offer solutions not only to an apartment hunt but to all such situations in life where we confront the question of optimal stopping. People grapple with these issues every day—although surely poets have spilled more ink on the tribulations of courtship than of parking—and they do so with, in some cases, considerable anguish. But the anguish is unnecessary. Mathematically, at least, these are solved problems.
在你度过一个普通的一周时,你身边每一个心烦意乱的租客、司机和追求者,本质上都是在重复做着重复的事情。他们不需要心理医生,他们需要的是一种算法。心理医生会告诉他们在冲动和过度思考之间找到一个合适的、舒适的平衡点。
Every harried renter, driver, and suitor you see around you as you go through a typical week is essentially reinventing the wheel. They don’t need a therapist; they need an algorithm. The therapist tells them to find the right, comfortable balance between impulsivity and overthinking.
算法告诉他们余额是百分之三十七。
The algorithm tells them the balance is thirty-seven percent.
* * *
* * *
每个人都会面临一系列特定的问题,这些问题的直接原因是我们生活在有限的空间和时间中。在一天或十年内,我们应该做什么,又应该留下什么?我们应该接受多大的混乱——多少秩序才算过度?在新的体验和喜欢的体验之间,如何平衡才能获得最充实的人生?
There is a particular set of problems that all people face, problems that are a direct result of the fact that our lives are carried out in finite space and time. What should we do, and leave undone, in a day or in a decade? What degree of mess should we embrace—and how much order is excessive? What balance between new experiences and favored ones makes for the most fulfilling life?
这些看似是人类独有的问题,但事实并非如此。半个多世纪以来,计算机科学家一直在努力解决这些日常难题的对应问题,很多情况下也得到了解决。处理器应该如何分配“注意力”,以最小的开销和最短的时间执行用户的所有请求?它应该何时在不同任务之间切换,以及它首先应该执行多少个任务?如何才能最好地利用有限的内存资源?它应该收集更多数据,还是根据已有的数据采取行动?把握时机对人类来说可能是一项挑战,但我们周围的计算机却能轻松地把握每一毫秒。我们可以从它们的做法中学到很多东西。
These might seem like problems unique to humans; they’re not. For more than half a century, computer scientists have been grappling with, and in many cases solving, the equivalents of these everyday dilemmas. How should a processor allocate its “attention” to perform all that the user asks of it, with the minimum overhead and in the least amount of time? When should it switch between different tasks, and how many tasks should it take on in the first place? What is the best way for it to use its limited memory resources? Should it collect more data, or take an action based on the data it already has? Seizing the day might be a challenge for humans, but computers all around us are seizing milliseconds with ease. And there’s much we can learn from how they do it.
谈论算法对人类生活的影响似乎有些奇怪。对许多人来说,“算法”一词会让人联想到大数据、大政府和大企业的神秘莫测:它们日益成为现代世界基础设施的一部分,却难以成为实用智慧或人类事务指导的来源。然而,算法只是用于解决问题的有限步骤序列,而且算法比计算机更广泛,也更古老。早在算法被机器使用之前,它们就已被人类使用。
Talking about algorithms for human lives might seem like an odd juxtaposition. For many people, the word “algorithm” evokes the arcane and inscrutable machinations of big data, big government, and big business: increasingly part of the infrastructure of the modern world, but hardly a source of practical wisdom or guidance for human affairs. But an algorithm is just a finite sequence of steps used to solve a problem, and algorithms are much broader—and older by far—than the computer. Long before algorithms were ever used by machines, they were used by people.
“算法”(algorithm)一词源于波斯数学家花拉子密(al-Khwārizmī)的名字,他撰写了一本公元九世纪的著作,其中介绍了手工计算数学的技巧。(他的书名为《数学之书》( al-Jabr wa'l-Muqābala),而书名中的“al-jabr”正是我们今天所用的“代数”(algebra)一词的来源。)然而,已知最早的数学算法甚至早于花拉子密的著作:在巴格达附近发现的一块距今四千年的苏美尔泥板描述了一种长除法的方案。
The word “algorithm” comes from the name of Persian mathematician al-Khwārizmī, author of a ninth-century book of techniques for doing mathematics by hand. (His book was called al-Jabr wa’l-Muqābala—and the “al-jabr” of the title in turn provides the source of our word “algebra.”) The earliest known mathematical algorithms, however, predate even al-Khwārizmī’s work: a four-thousand-year-old Sumerian clay tablet found near Baghdad describes a scheme for long division.
但算法并不仅限于数学。当你按照食谱烤面包时,你遵循的是一种算法。当你按照图样织毛衣时,你遵循的也是一种算法。当你用鹿角末端以精确的顺序敲击燧石,使其变得锋利时——这是制作精细石器的关键步骤——你遵循的也是算法。自石器时代以来,算法一直是人类科技的一部分。
But algorithms are not confined to mathematics alone. When you cook bread from a recipe, you’re following an algorithm. When you knit a sweater from a pattern, you’re following an algorithm. When you put a sharp edge on a piece of flint by executing a precise sequence of strikes with the end of an antler—a key step in making fine stone tools—you’re following an algorithm. Algorithms have been a part of human technology ever since the Stone Age.
* * *
* * *
在本书中,我们探索了人类算法设计的理念——为人们每天遇到的挑战寻找更好的解决方案。将计算机科学的视角应用于日常生活,将在多个层面产生影响。最直接的是,它为我们提供了解决具体问题的实用、具体的建议。最优停止告诉我们何时观察,何时跳跃。探索/利用权衡告诉我们如何在尝试新事物和享受我们喜欢的事物之间找到平衡。排序理论告诉我们如何(以及是否)布置办公室。缓存理论告诉我们如何填满我们的衣柜。日程安排理论告诉我们如何安排时间。
In this book, we explore the idea of human algorithm design—searching for better solutions to the challenges people encounter every day. Applying the lens of computer science to everyday life has consequences at many scales. Most immediately, it offers us practical, concrete suggestions for how to solve specific problems. Optimal stopping tells us when to look and when to leap. The explore/exploit tradeoff tells us how to find the balance between trying new things and enjoying our favorites. Sorting theory tells us how (and whether) to arrange our offices. Caching theory tells us how to fill our closets. Scheduling theory tells us how to fill our time.
在下一个层面,计算机科学为我们提供了理解每个领域中深层原理的词汇。正如卡尔·萨根所说:“科学与其说是知识体系,不如说是一种思维方式。” 即使在生活过于复杂以至于我们无法期待严格的数值分析或现成答案的情况下,运用在这些问题的简单形式上磨练出的直觉和概念,也能让我们理解关键问题并取得进展。
At the next level, computer science gives us a vocabulary for understanding the deeper principles at play in each of these domains. As Carl Sagan put it, “Science is a way of thinking much more than it is a body of knowledge.” Even in cases where life is too messy for us to expect a strict numerical analysis or a ready answer, using intuitions and concepts honed on the simpler forms of these problems offers us a way to understand the key issues and make progress.
从更广阔的角度来看,透过计算机科学的视角,我们可以了解人类思维的本质、理性的意义,以及最古老的问题:如何生存。将认知作为解决环境所引发的根本计算问题的一种手段,可以彻底改变我们对人类理性的思考方式。
Most broadly, looking through the lens of computer science can teach us about the nature of the human mind, the meaning of rationality, and the oldest question of all: how to live. Examining cognition as a means of solving the fundamentally computational problems posed by our environment can utterly change the way we think about human rationality.
研究计算机内部工作原理或许能揭示人类如何思考、如何决策、如何相信以及如何行动,这种想法在很多人看来不仅过于简化,而且实际上是一种误导。即便计算机科学真的能解释人类如何思考和行动,我们又会愿意倾听吗?我们看着科幻小说里的人工智能和机器人,似乎它们的生活并非我们任何人想要的。
The notion that studying the inner workings of computers might reveal how to think and decide, what to believe and how to behave, might strike many people as not only wildly reductive, but in fact misguided. Even if computer science did have things to say about how to think and how to act, would we want to listen? We look at the AIs and robots of science fiction, and it seems like theirs is not a life any of us would want to live.
部分原因在于,当我们思考计算机时,我们想到的是冰冷的机械、确定性的系统:机器运用严格的演绎逻辑,通过详尽列举所有选项来做出决策,无论需要思考多久、多么艰辛,最终都能得出完全正确的答案。事实上,最初设想计算机的人心中也构思了类似的想法。艾伦·图灵通过类比人类数学家,定义了计算的概念,人类数学家需要仔细完成冗长的计算步骤,最终得出一个绝对正确的答案。
In part, that’s because when we think about computers, we think about coldly mechanical, deterministic systems: machines applying rigid deductive logic, making decisions by exhaustively enumerating the options, and grinding out the exact right answer no matter how long and hard they have to think. Indeed, the person who first imagined computers had something essentially like this in mind. Alan Turing defined the very notion of computation by an analogy to a human mathematician who carefully works through the steps of a lengthy calculation, yielding an unmistakably right answer.
因此,现代计算机在面对难题时实际上并非如此,这或许会让人感到惊讶。当然,简单的算术运算对现代计算机来说并非特别具有挑战性。相反,诸如与人交谈、修复损坏的文件或赢得一场围棋比赛之类的任务——规则不明确、缺少部分必要信息,或者要找到准确答案需要考虑海量可能性的问题——才是当今计算机科学面临的最大挑战。研究人员为解决最难问题而开发的算法,已经使计算机摆脱了对穷举计算的过度依赖。相反,处理现实世界的任务需要适应随机性,在时间和准确性之间做出权衡,并使用近似值。
So it might come as a surprise that this is not what modern computers are actually doing when they face a difficult problem. Straightforward arithmetic, of course, isn’t particularly challenging for a modern computer. Rather, it’s tasks like conversing with people, fixing a corrupted file, or winning a game of Go—problems where the rules aren’t clear, some of the required information is missing, or finding exactly the right answer would require considering an astronomical number of possibilities—that now pose the biggest challenges in computer science. And the algorithms that researchers have developed to solve the hardest classes of problems have moved computers away from an extreme reliance on exhaustive calculation. Instead, tackling real-world tasks requires being comfortable with chance, trading off time with accuracy, and using approximations.
随着计算机越来越擅长解决现实世界的问题,它们不仅提供了可供人们借鉴的算法,还提供了一个更完善的标准来比较人类认知本身。在过去的一二十年里,行为经济学讲述了一个关于人类的非常独特的故事:我们是非理性的、容易犯错的,这在很大程度上源于大脑中缺陷重重、特有的硬件。这个自嘲式的故事越来越为人熟知,但某些问题仍然令人困惑。例如,为什么四岁小孩在一系列认知任务上,包括视觉、语言和因果推理,仍然比价值数百万美元的超级计算机更胜一筹?
As computers become better tuned to real-world problems, they provide not only algorithms that people can borrow for their own lives, but a better standard against which to compare human cognition itself. Over the past decade or two, behavioral economics has told a very particular story about human beings: that we are irrational and error-prone, owing in large part to the buggy, idiosyncratic hardware of the brain. This self-deprecating story has become increasingly familiar, but certain questions remain vexing. Why are four-year-olds, for instance, still better than million-dollar supercomputers at a host of cognitive tasks, including vision, language, and causal reasoning?
计算机科学为日常问题提供的解决方案,讲述了人类思维的另一个故事。生活中充满了各种难题,简而言之,它们很难解决。人们所犯的错误往往更多地反映了问题本身的复杂性,而非人脑的易错性。用算法思考世界,了解我们所面临问题的基本结构及其解决方案的属性,可以帮助我们认识到自身的优秀程度,并更好地理解我们所犯的错误。
The solutions to everyday problems that come from computer science tell a different story about the human mind. Life is full of problems that are, quite simply, hard. And the mistakes made by people often say more about the intrinsic difficulties of the problem than about the fallibility of human brains. Thinking algorithmically about the world, learning about the fundamental structures of the problems we face and about the properties of their solutions, can help us see how good we actually are, and better understand the errors that we make.
事实上,人类总是面临着计算机科学家研究的一些最棘手的问题。人们常常需要在应对不确定性、时间限制、部分信息和快速变化的世界时做出决策。在某些情况下,即使是尖端的计算机科学也尚未提出高效、始终正确的算法。在某些情况下,这样的算法似乎根本不存在。
In fact, human beings turn out to consistently confront some of the hardest cases of the problems studied by computer scientists. Often, people need to make decisions while dealing with uncertainty, time constraints, partial information, and a rapidly changing world. In some of those cases, even cutting-edge computer science has not yet come up with efficient, always-right algorithms. For certain situations it appears that such algorithms might not exist at all.
然而,即使在尚未找到完美算法的地方,一代又一代计算机科学家与最棘手的现实世界问题的斗争也带来了一系列深刻的见解。这些来之不易的信条与我们对理性的直觉相悖,它们听起来一点也不像数学家试图强行将世界划入清晰、正式的界限时所给出的狭隘处方。它们说:不要总是考虑所有的选择。不必每次都追求看起来最好的结果。偶尔制造点混乱。轻装上阵。让事情等待。相信你的直觉,不要想太久。放松。抛硬币。原谅,但不要忘记。忠于自己。
Even where perfect algorithms haven’t been found, however, the battle between generations of computer scientists and the most intractable real-world problems has yielded a series of insights. These hard-won precepts are at odds with our intuitions about rationality, and they don’t sound anything like the narrow prescriptions of a mathematician trying to force the world into clean, formal lines. They say: Don’t always consider all your options. Don’t necessarily go for the outcome that seems best every time. Make a mess on occasion. Travel light. Let things wait. Trust your instincts and don’t think too long. Relax. Toss a coin. Forgive, but don’t forget. To thine own self be true.
毕竟,遵循计算机科学的智慧生活听起来并不坏。而且与大多数建议不同,它有证据支持。
Living by the wisdom of computer science doesn’t sound so bad after all. And unlike most advice, it’s backed up by proofs.
* * *
* * *
正如计算机算法设计最初是一门介于学科之间的学科——一种数学与工程学的奇怪混合体——一样,为人类设计算法也是一个没有天然学科归属的课题。如今,算法设计不仅借鉴了计算机科学、数学和工程学,还借鉴了统计学和运筹学等相关领域。当我们思考为机器设计的算法如何与人类思维联系起来时,我们也需要关注认知科学、心理学、经济学以及其他学科。
Just as designing algorithms for computers was originally a subject that fell into the cracks between disciplines—an odd hybrid of mathematics and engineering—so, too, designing algorithms for humans is a topic that doesn’t have a natural disciplinary home. Today, algorithm design draws not only on computer science, math, and engineering but on kindred fields like statistics and operations research. And as we consider how algorithms designed for machines might relate to human minds, we also need to look to cognitive science, psychology, economics, and beyond.
我们,作为本文的作者,对这个跨学科领域非常熟悉。Brian 学习过计算机科学和哲学,之后继续攻读英语研究生学位,并从事这三者交叉学科的职业。Tom 在成为加州大学伯克利分校教授之前学习过心理学和统计学,在那里他大部分时间都在思考人类认知与计算之间的关系。但是,没有人能够精通所有与设计更适合人类的算法相关的领域。因此,为了寻找值得我们遵循的算法,我们采访了过去五十年中一些最著名算法的提出者。我们询问了他们——一些世界上最聪明的人——他们的研究如何影响了他们的生活方式——从寻找伴侣到整理袜子。
We, your authors, are familiar with this interdisciplinary territory. Brian studied computer science and philosophy before going on to graduate work in English and a career at the intersection of the three. Tom studied psychology and statistics before becoming a professor at UC Berkeley, where he spends most of his time thinking about the relationship between human cognition and computation. But nobody can be an expert in all of the fields that are relevant to designing better algorithms for humans. So as part of our quest for algorithms to live by, we talked to the people who came up with some of the most famous algorithms of the last fifty years. And we asked them, some of the smartest people in the world, how their research influenced the way they approached their own lives—from finding their spouses to sorting their socks.
接下来的篇幅将带我们探索计算机和人类思维共同面临的一些重大挑战:如何管理有限的空间、有限的时间、有限的注意力、未知的未知数、不完整的信息以及不可预见的未来;如何优雅而自信地应对这些挑战;以及如何在一个与其他同样努力应对挑战的群体中共同应对这些挑战。我们将了解这些挑战的基本数学结构,以及计算机是如何被设计出来的——有时甚至与我们的想象背道而驰——从而最大限度地利用这些挑战。我们还将了解思维的运作方式,了解它处理同一组问题和应对相同约束的独特而又紧密相关的方法。最终,我们能够获得的不仅仅是针对我们周围问题的一系列具体启示,不仅仅是一种看待即使是最棘手的人类困境背后精妙结构的新视角,不仅仅是认识到人类和计算机的苦难是紧密相连的,还有更深层次的东西:一种描述我们周围世界的新词汇,以及一个真正了解我们自身的机会。
The next pages begin our journey through some of the biggest challenges faced by computers and human minds alike: how to manage finite space, finite time, limited attention, unknown unknowns, incomplete information, and an unforeseeable future; how to do so with grace and confidence; and how to do so in a community with others who are all simultaneously trying to do the same. We will learn about the fundamental mathematical structure of these challenges and about how computers are engineered—sometimes counter to what we imagine—to make the most of them. And we will learn about how the mind works, about its distinct but deeply related ways of tackling the same set of issues and coping with the same constraints. Ultimately, what we can gain is not only a set of concrete takeaways for the problems around us, not only a new way to see the elegant structures behind even the hairiest human dilemmas, not only a recognition of the travails of humans and computers as deeply conjoined, but something even more profound: a new vocabulary for the world around us, and a chance to learn something truly new about ourselves.
虽然所有基督徒在婚礼请柬的开头都会郑重地宣布,他们的婚姻是出于上帝的特殊安排,但作为一名哲学家,我想更详细地谈谈这一点……
Though all Christians start a wedding invitation by solemnly declaring their marriage is due to special Divine arrangement, I, as a philosopher, would like to talk in greater detail about this …
—约翰内斯·开普勒
—JOHANNES KEPLER
如果您比其他任何人都更喜欢马丁先生;如果您认为他是您曾经结识过的最令人愉快的人,那么您为什么要犹豫呢?
If you prefer Mr. Martin to every other person; if you think him the most agreeable man you have ever been in company with, why should you hesitate?
——简·奥斯汀, 《爱玛》
—JANE AUSTEN, EMMA
这种现象非常普遍,大学指导老师甚至有一个俚语来形容它:“火鸡掉落”。高中时的情侣们在大学一年级时回家过感恩节,四天后就单身重返校园。
It’s such a common phenomenon that college guidance counselors even have a slang term for it: the “turkey drop.” High-school sweethearts come home for Thanksgiving of their freshman year of college and, four days later, return to campus single.
布莱恩大一的时候,焦虑不安,去找了自己的大学升学指导老师。他的高中女友去了几个州外的另一所大学,两人为远距离而苦恼。他们还纠结于一个更奇怪、更哲学的问题:他们的感情有多好?他们没有其他感情的真正标杆来评判。布莱恩的指导老师认为他们面临的是典型的大一困境,所以出人意料地漫不经心地给了他建议:“收集数据。”
An angst-ridden Brian went to his own college guidance counselor his freshman year. His high-school girlfriend had gone to a different college several states away, and they struggled with the distance. They also struggled with a stranger and more philosophical question: how good a relationship did they have? They had no real benchmark of other relationships by which to judge it. Brian’s counselor recognized theirs as a classic freshman-year dilemma, and was surprisingly nonchalant in her advice: “Gather data.”
广义上讲,连续一夫一妻制的本质在于,它的实践者面临着一个根本的、不可避免的问题。你什么时候见过足够多的人,才能知道谁是你的最佳伴侣?如果获取这些信息反而让你失去了那个最佳伴侣呢?这似乎是心灵的终极困境。
The nature of serial monogamy, writ large, is that its practitioners are confronted with a fundamental, unavoidable problem. When have you met enough people to know who your best match is? And what if acquiring the data costs you that very match? It seems the ultimate Catch-22 of the heart.
正如我们所见,这个“第 22 条军规”,这个焦虑的新生的呐喊,就是数学家所说的“最佳停止”问题,而它实际上可能有一个答案:37%。
As we have seen, this Catch-22, this angsty freshman cri de coeur, is what mathematicians call an “optimal stopping” problem, and it may actually have an answer: 37%.
当然,这一切都取决于你愿意对爱情做出什么样的假设。
Of course, it all depends on the assumptions you’re willing to make about love.
秘书问题
The Secretary Problem
在任何最优停车问题中,关键的难题并非在于选择哪个选项,而是需要考虑多少个选项。这些问题不仅对恋人和租客有影响,也对司机、房主、窃贼等等都有影响。
In any optimal stopping problem, the crucial dilemma is not which option to pick, but how many options to even consider. These problems turn out to have implications not only for lovers and renters, but also for drivers, homeowners, burglars, and beyond.
37% 规则*源自最优停止最著名的难题,即后来的“秘书问题”。其设置很像我们之前考虑过的公寓猎头困境。想象一下,你正在面试一组秘书职位的申请人,你的目标是最大限度地录用候选人中最优秀的那一位。虽然你不知道如何给各个申请人打分,但你可以轻松判断自己更倾向于哪一位。(数学家可能会说,你只能使用序数词——申请人之间的相对排名,而不能使用基数,即他们在某种通用尺度上的评分。)你以随机顺序逐一面试申请人。你可以在任何时候决定是否录用某位申请人,他们肯定会接受,从而终止搜索。但如果你忽略了某位申请人,决定不录用他们,他们就永远离开了。
The 37% Rule* derives from optimal stopping’s most famous puzzle, which has come to be known as the “secretary problem.” Its setup is much like the apartment hunter’s dilemma that we considered earlier. Imagine you’re interviewing a set of applicants for a position as a secretary, and your goal is to maximize the chance of hiring the single best applicant in the pool. While you have no idea how to assign scores to individual applicants, you can easily judge which one you prefer. (A mathematician might say you have access only to the ordinal numbers—the relative ranks of the applicants compared to each other—but not to the cardinal numbers, their ratings on some kind of general scale.) You interview the applicants in random order, one at a time. You can decide to offer the job to an applicant at any point and they are guaranteed to accept, terminating the search. But if you pass over an applicant, deciding not to hire them, they are gone forever.
人们普遍认为秘书问题首次出现在 1960 年 2 月的《科学美国人》杂志上,但并未明确提及秘书。它是马丁·加德纳备受喜爱的休闲数学专栏中提出的几个难题之一。但这个问题的起源却出奇地神秘。我们最初的搜索除了猜测外,几乎没有什么收获,后来变成了意想不到的实际侦探工作:我们驱车前往斯坦福的加德纳论文档案馆,搬出他上世纪中叶的几箱信件。阅读纸质信件有点像偷听某人的电话:你只听到通话的一方,必须推断另一方。在我们这里,我们只得到了加德纳 50 年前自己对问题起源的探索的答复。我们读得越多,故事就变得越错综复杂和不清楚。
The secretary problem is widely considered to have made its first appearance in print—sans explicit mention of secretaries—in the February 1960 issue of Scientific American, as one of several puzzles posed in Martin Gardner’s beloved column on recreational mathematics. But the origins of the problem are surprisingly mysterious. Our own initial search yielded little but speculation, before turning into unexpectedly physical detective work: a road trip down to the archive of Gardner’s papers at Stanford, to haul out boxes of his midcentury correspondence. Reading paper correspondence is a bit like eavesdropping on someone who’s on the phone: you’re only hearing one side of the exchange, and must infer the other. In our case, we only had the replies to what was apparently Gardner’s own search for the problem’s origins fiftysome years ago. The more we read, the more tangled and unclear the story became.
哈佛大学数学家弗雷德里克·莫斯特勒(Frederick Mosteller)回忆起1955年从同事安德鲁·格里森(Andrew Gleason)那里听说了这个问题,而格里森是从别人那里听说的。阿尔伯塔大学的利奥·莫泽(Leo Moser)写信说,他在波音公司(Boeing)的RE·加斯凯尔(R.E. Gaskell)的“一些笔记”中读到了这个问题,而加斯凯尔本人也承认了自己是同事。罗格斯大学的罗杰·平克汉姆(Roger Pinkham)写道,他第一次听说这个问题是在1955年,从杜克大学数学家J.肖恩菲尔德(J. Shoenfield)那里,“我相信他说他是从密歇根大学的某个人那里听说的。”
Harvard mathematician Frederick Mosteller recalled hearing about the problem in 1955 from his colleague Andrew Gleason, who had heard about it from somebody else. Leo Moser wrote from the University of Alberta to say that he read about the problem in “some notes” by R. E. Gaskell of Boeing, who himself credited a colleague. Roger Pinkham of Rutgers wrote that he first heard of the problem in 1955 from Duke University mathematician J. Shoenfield, “and I believe he said that he had heard the problem from someone at Michigan.”
“密歇根大学的某人”几乎可以肯定是梅里尔·弗勒德(Merrill Flood)。尽管弗勒德在数学界之外鲜为人知,但他对计算机科学的影响几乎是无法回避的。他因推广旅行商问题(我们将在第8章详细讨论)、设计囚徒困境(我们将在第11章讨论)以及可能创造“软件”一词而备受赞誉。弗勒德于1958年首次发现了37%规则,并声称自己自1949年以来一直在思考这个问题——但他自己也指出了其他几位数学家的研究成果。
“Someone at Michigan” was almost certainly someone named Merrill Flood. Though he is largely unheard of outside mathematics, Flood’s influence on computer science is almost impossible to avoid. He’s credited with popularizing the traveling salesman problem (which we discuss in more detail in chapter 8), devising the prisoner’s dilemma (which we discuss in chapter 11), and even with possibly coining the term “software.” It’s Flood who made the first known discovery of the 37% Rule, in 1958, and he claims to have been considering the problem since 1949—but he himself points back to several other mathematicians.
可以肯定地说,无论秘书问题源自何处,它都被证明是一个近乎完美的数学难题:解释简单,解决起来却异常棘手,答案简洁明了,其蕴含也引人入胜。因此,它在20世纪50年代的数学界如野火般蔓延,口口相传,并得益于加德纳1960年的专栏文章,最终引发了公众的广泛关注。到了20世纪80年代,这个问题及其变体已经引发了大量的分析,以至于它甚至开始作为一个独立的子领域在论文中被讨论。
Suffice it to say that wherever it came from, the secretary problem proved to be a near-perfect mathematical puzzle: simple to explain, devilish to solve, succinct in its answer, and intriguing in its implications. As a result, it moved like wildfire through the mathematical circles of the 1950s, spreading by word of mouth, and thanks to Gardner’s column in 1960 came to grip the imagination of the public at large. By the 1980s the problem and its variations had produced so much analysis that it had come to be discussed in papers as a subfield unto itself.
至于秘书——观察每种文化在正式系统中融入其独特的人类学解读,颇具趣味。例如,我们认为国际象棋的形象源于中世纪欧洲,但实际上它起源于公元八世纪的印度;在十五世纪,随着沙阿成为国王,维齐尔成为王后,大象成为主教,国际象棋被粗暴地“欧化”。同样,最优停止问题也经历了多种演变,每种都反映了其时代的主流关注点。在十九世纪,这类问题的典型代表是巴洛克式的彩票和女性选择男性追求者;在二十世纪初,这类问题的典型代表是度假驾车者寻找酒店和男性追求者选择女性;而在二十世纪中期,以男性为主导的、文件处理行业,这类问题的典型代表是男性老板选择女性助理。第一次明确提到这个问题,并将其命名为“秘书问题”,似乎是在 1964 年的一篇论文中,后来这个名字就沿用至今。
As for secretaries—it’s charming to watch each culture put its own anthropological spin on formal systems. We think of chess, for instance, as medieval European in its imagery, but in fact its origins are in eighth-century India; it was heavy-handedly “Europeanized” in the fifteenth century, as its shahs became kings, its viziers turned to queens, and its elephants became bishops. Likewise, optimal stopping problems have had a number of incarnations, each reflecting the predominating concerns of its time. In the nineteenth century such problems were typified by baroque lotteries and by women choosing male suitors; in the early twentieth century by holidaying motorists searching for hotels and by male suitors choosing women; and in the paper-pushing, male-dominated mid-twentieth century, by male bosses choosing female assistants. The first explicit mention of it by name as the “secretary problem” appears to be in a 1964 paper, and somewhere along the way the name stuck.
37%从何而来?
Whence 37%?
在寻找秘书的过程中,有两种情况可能会失败:过早停止和过晚停止。过早停止会导致最佳候选人被遗漏。过晚停止会导致更合适的候选人被搁置,而这个候选人根本不存在。最佳策略显然需要在两者之间找到平衡,在寻找过多和不足之间找到平衡。
In your search for a secretary, there are two ways you can fail: stopping early and stopping late. When you stop too early, you leave the best applicant undiscovered. When you stop too late, you hold out for a better applicant who doesn’t exist. The optimal strategy will clearly require finding the right balance between the two, walking the tightrope between looking too much and not enough.
如果你的目标是找到最优秀的申请人,不满足于现状,那么在面试过程中,你显然不应该考虑录用一个不是你迄今为止见过的最优秀的人。然而,仅仅成为迄今为止最优秀的申请人并不足以让你获得录用;例如,第一位申请人当然就是迄今为止最优秀的。更普遍的是,随着面试的进行,我们遇到“迄今为止最优秀”申请人的概率会下降。例如,第二位申请人有50%的几率是我们见过的最优秀的申请人,但第五位申请人只有五分之一的几率成为迄今为止最优秀的申请人,第六位有六分之一的几率,以此类推。因此,随着搜索的进行,迄今为止最优秀的申请人会变得越来越令人印象深刻(再次强调,他们比之前的所有申请人都优秀)——但他们出现的频率也会越来越低。
If your aim is finding the very best applicant, settling for nothing less, it’s clear that as you go through the interview process you shouldn’t even consider hiring somebody who isn’t the best you’ve seen so far. However, simply being the best yet isn’t enough for an offer; the very first applicant, for example, will of course be the best yet by definition. More generally, it stands to reason that the rate at which we encounter “best yet” applicants will go down as we proceed in our interviews. For instance, the second applicant has a 50/50 chance of being the best we’ve yet seen, but the fifth applicant only has a 1-in-5 chance of being the best so far, the sixth has a 1-in-6 chance, and so on. As a result, best-yet applicants will become steadily more impressive as the search continues (by definition, again, they’re better than all those who came before)—but they will also become more and more infrequent.
好吧,我们知道,录用我们遇到的第一个迄今为止最优秀的申请人(也就是第一个申请人,就是这样)是草率的。如果有一百个申请人,仅仅因为她比第一个申请人优秀就给下一个迄今为止最优秀的申请人录用,似乎也太草率了。那么,我们该怎么做呢?
Okay, so we know that taking the first best-yet applicant we encounter (a.k.a. the first applicant, period) is rash. If there are a hundred applicants, it also seems hasty to make an offer to the next one who’s best-yet, just because she was better than the first. So how do we proceed?
直观来看,有几种潜在的策略。例如,当申请人第三次(或者第四次)胜过所有候选人时,就发出录用通知。或者,在经历了一段漫长的“低谷期”(一连串糟糕的申请)之后,再录用下一个最优秀的申请人。
Intuitively, there are a few potential strategies. For instance, making an offer the third time an applicant trumps everyone seen so far—or maybe the fourth time. Or perhaps taking the next best-yet applicant to come along after a long “drought”—a long streak of poor ones.
但实际上,这两种相对明智的策略都没有取得预期的效果。最佳解决方案采取了我们称之为“先看后跃”的原则:你设定一段预定的“看”的时间——也就是探索你的选择,收集数据——在此期间,无论候选人多么优秀,你都绝对不会选择。之后,你进入“跃”阶段,准备立即聘用任何比你在“看”阶段看到的最佳候选人更优秀的人选。
But as it happens, neither of these relatively sensible strategies comes out on top. Instead, the optimal solution takes the form of what we’ll call the Look-Then-Leap Rule: You set a predetermined amount of time for “looking”—that is, exploring your options, gathering data—in which you categorically don’t choose anyone, no matter how impressive. After that point, you enter the “leap” phase, prepared to instantly commit to anyone who outshines the best applicant you saw in the look phase.
我们可以通过考察秘书问题在规模最小的求职者群体中如何运作来理解“先看后做”规则是如何产生的。如果只有一位求职者,问题很容易解决——聘用她!如果是两位求职者,无论你做什么,成功的几率都是各占一半。你可以聘用第一位求职者(他有一半的几率是最优秀的),或者解雇第一位,然后默认聘用第二位求职者(他也有一半的几率是最优秀的)。
We can see how the Look-Then-Leap Rule emerges by considering how the secretary problem plays out in the smallest applicant pools. With just one applicant the problem is easy to solve—hire her! With two applicants, you have a 50/50 chance of success no matter what you do. You can hire the first applicant (who’ll turn out to be the best half the time), or dismiss the first and by default hire the second (who is also best half the time).
再加上第三位申请人,事情突然变得有趣起来。如果我们随机录用,录用的几率是三分之一,也就是33%。如果只有两位申请人,我们只能碰运气;如果只有三位,我们能做到吗?事实证明我们可以,而这一切都取决于我们如何对待第二位面试者。当我们看到第一位申请人时,我们没有任何信息——她看起来总是最好的。当我们看到第三位申请人时,我们没有代理机构——我们必须向最后一位申请人发出录用通知,因为我们已经解雇了其他申请人。但当我们看到第二位申请人时,我们两者兼而有之:我们知道她比第一位申请人好还是差,并且我们可以自由选择录用或解雇她。如果我们只在她比第一位申请人优秀时录用她,如果她不优秀就解雇她,会发生什么情况?事实证明,这是面对三位申请人时的最佳策略;令人惊讶的是,使用这种方法,在三位申请人的问题上取得的效果可能与两位申请人的问题一样好,恰好有一半的几率会选择最佳申请人。*
Add a third applicant, and all of a sudden things get interesting. The odds if we hire at random are one-third, or 33%. With two applicants we could do no better than chance; with three, can we? It turns out we can, and it all comes down to what we do with the second interviewee. When we see the first applicant, we have no information—she’ll always appear to be the best yet. When we see the third applicant, we have no agency—we have to make an offer to the final applicant, since we’ve dismissed the others. But when we see the second applicant, we have a little bit of both: we know whether she’s better or worse than the first, and we have the freedom to either hire or dismiss her. What happens when we just hire her if she’s better than the first applicant, and dismiss her if she’s not? This turns out to be the best possible strategy when facing three applicants; using this approach it’s possible, surprisingly, to do just as well in the three-applicant problem as with two, choosing the best applicant exactly half the time.*
列举四名申请人的这些情况告诉我们,我们仍然应该在第二名申请人出现时就开始考虑;当候选人池中有五名申请人时,我们不应该在第三名申请人出现之前就开始考虑。
Enumerating these scenarios for four applicants tells us that we should still begin to leap as soon as the second applicant; with five applicants in the pool, we shouldn’t leap before the third.
随着申请者人数的增加,观察和直接录取之间的界限就落在了申请者人数的 37% 上,这就产生了 37% 规则:先看前 37% 的申请者,*不选一个,然后准备选择比你目前见过的所有人更优秀的人。
As the applicant pool grows, the exact place to draw the line between looking and leaping settles to 37% of the pool, yielding the 37% Rule: look at the first 37% of the applicants,* choosing none, then be ready to leap for anyone better than all those you’ve seen so far.
如何最佳地选择秘书。
How to optimally choose a secretary.
事实证明,遵循这一最优策略最终能让我们录用最佳申请人的概率达到 37%;该问题奇妙的数学对称性之一在于,策略本身和其成功概率最终会得出相同的数字。上表展示了秘书问题在不同申请人数量下的最优策略,表明成功概率(例如从“寻找”切换到“跳跃”的时机)随着申请人数量的增加而收敛到 37%。
As it turns out, following this optimal strategy ultimately gives us a 37% chance of hiring the best applicant; it’s one of the problem’s curious mathematical symmetries that the strategy itself and its chance of success work out to the very same number. The table above shows the optimal strategy for the secretary problem with different numbers of applicants, demonstrating how the chance of success—like the point to switch from looking to leaping—converges on 37% as the number of applicants increases.
即使采用最佳策略, 63% 的失败率也是一个令人警醒的事实。即使我们在秘书问题上采取了最佳策略,我们仍然会大多数时候失败——也就是说,我们最终不会在候选人库中找到最合适的那个人。对于那些将爱情定义为寻找“那个人”的人来说,这是个坏消息。但也有一线希望。直觉告诉我们,随着候选人库的增长,我们挑选出最合适候选人的几率应该会稳步下降。例如,如果我们随机招聘,那么在 100 名候选人中我们的成功几率为 1%,而在 100 万名候选人中我们的成功几率只有 0.0001%。但值得注意的是,秘书问题的数学原理并没有改变。如果你以最佳方式停止,你在 100 名候选人中找到最合适候选人的几率是 37%。不管你信不信,在 100 万名候选人中,你的几率仍然是 37%。因此,申请人池越大,了解最优算法就越有价值。诚然,大多数情况下你不太可能找到针,但无论大海捞针的规模有多大,最优停顿法都是你应对大海的最佳防御手段。
A 63% failure rate, when following the best possible strategy, is a sobering fact. Even when we act optimally in the secretary problem, we will still fail most of the time—that is, we won’t end up with the single best applicant in the pool. This is bad news for those of us who would frame romance as a search for “the one.” But here’s the silver lining. Intuition would suggest that our chances of picking the single best applicant should steadily decrease as the applicant pool grows. If we were hiring at random, for instance, then in a pool of a hundred applicants we’d have a 1% chance of success, and in a pool of a million applicants we’d have a 0.0001% chance. Yet remarkably, the math of the secretary problem doesn’t change. If you’re stopping optimally, your chance of finding the single best applicant in a pool of a hundred is 37%. And in a pool of a million, believe it or not, your chance is still 37%. Thus the bigger the applicant pool gets, the more valuable knowing the optimal algorithm becomes. It’s true that you’re unlikely to find the needle the majority of the time, but optimal stopping is your best defense against the haystack, no matter how large.
情人崖
Lover’s Leap
两性之间的激情在各个时代都表现得几乎相同,以代数语言来说,它总是可以被视为一个给定的量。
The passion between the sexes has appeared in every age to be so nearly the same that it may always be considered, in algebraic language, as a given quantity.
—托马斯·马尔萨斯
—THOMAS MALTHUS
我嫁给了我第一个亲吻的男人。当我把这件事告诉我的孩子们时,他们差点吐了。
I married the first man I ever kissed. When I tell this to my children they just about throw up.
—芭芭拉·布什
—BARBARA BUSH
在成为卡内基梅隆大学运筹学教授之前,迈克尔·特里克是一名正在寻找爱情的研究生。“我突然意识到这个问题已经被研究过了:这就是秘书问题!我有一个职位空缺,[和]一系列申请人,我的目标是选出最合适的申请人。”于是他计算了一下。他不知道自己一生中会遇到多少女性,但37%规则有一定的灵活性:它可以应用于申请人的数量,也可以应用于寻找的时间。假设他的寻找年龄从18岁到40岁,那么37%规则给出的年龄是26.1岁,是从“寻找”转向“跃跃欲试”的临界点。而这个数字恰好是特里克当时的年龄。所以,当他找到一个比迄今为止所有约会对象都更合适的女人时,他清楚地知道该怎么做。他跃跃欲试。 “我不知道她是否完美(模型的假设不允许我确定这一点),但毫无疑问她符合算法这一步的条件。所以我求婚了,”他写道。
Before he became a professor of operations research at Carnegie Mellon, Michael Trick was a graduate student, looking for love. “It hit me that the problem has been studied: it is the Secretary Problem! I had a position to fill [and] a series of applicants, and my goal was to pick the best applicant for the position.” So he ran the numbers. He didn’t know how many women he could expect to meet in his lifetime, but there’s a certain flexibility in the 37% Rule: it can be applied to either the number of applicants or the time over which one is searching. Assuming that his search would run from ages eighteen to forty, the 37% Rule gave age 26.1 years as the point at which to switch from looking to leaping. A number that, as it happened, was exactly Trick’s age at the time. So when he found a woman who was a better match than all those he had dated so far, he knew exactly what to do. He leapt. “I didn’t know if she was Perfect (the assumptions of the model don’t allow me to determine that), but there was no doubt that she met the qualifications for this step of the algorithm. So I proposed,” he writes.
“但她拒绝了我。”
“And she turned me down.”
至少从17世纪开始,数学家们就一直为爱情所困扰。如今,传奇天文学家约翰尼斯·开普勒或许最为人铭记,因为他发现了行星轨道是椭圆形的,并成为“哥白尼革命”的关键人物。这场革命包括伽利略和牛顿的参与,颠覆了人类对自身在天体中地位的认知。但开普勒也对地球怀有忧虑。1611年,第一任妻子去世后,开普勒开始了漫长而艰辛的再婚之旅,最终追求了11位女性。在最初的四个女人中,开普勒最喜欢第四位(“因为她身材高挑,体魄健壮”),但他并没有停止寻找。开普勒写道:“如果不是爱情和理智迫使我选择第五位女性,事情本来可以水到渠成。这位女性用爱、谦逊的忠诚、节俭的家务、勤奋以及她对继子女的爱赢得了我的芳心。”
Mathematicians have been having trouble with love since at least the seventeenth century. The legendary astronomer Johannes Kepler is today perhaps best remembered for discovering that planetary orbits are elliptical and for being a crucial part of the “Copernican Revolution” that included Galileo and Newton and upended humanity’s sense of its place in the heavens. But Kepler had terrestrial concerns, too. After the death of his first wife in 1611, Kepler embarked on a long and arduous quest to remarry, ultimately courting a total of eleven women. Of the first four, Kepler liked the fourth the best (“because of her tall build and athletic body”) but did not cease his search. “It would have been settled,” Kepler wrote, “had not both love and reason forced a fifth woman on me. This one won me over with love, humble loyalty, economy of household, diligence, and the love she gave the stepchildren.”
“然而,”他写道,“我还是继续了。”
“However,” he wrote, “I continued.”
开普勒的亲朋好友不断为他引荐,他也一直在寻找,但总是漫不经心。他的心思始终停留在第五位女性身上。在总共追求了十一位女性之后,他决定不再继续追寻。“准备前往雷根斯堡时,我又回到了第五位女性身边,向她表白,并得到了她的认可。” 开普勒和苏珊娜·罗伊廷格结婚,育有六个孩子,加上他与第一任妻子所生的孩子。传记中将开普勒余下的家庭生活描述为一段格外平静和快乐的时光。
Kepler’s friends and relations went on making introductions for him, and he kept on looking, but halfheartedly. His thoughts remained with number five. After eleven courtships in total, he decided he would search no further. “While preparing to travel to Regensburg, I returned to the fifth woman, declared myself, and was accepted.” Kepler and Susanna Reuttinger were wed and had six children together, along with the children from Kepler’s first marriage. Biographies describe the rest of Kepler’s domestic life as a particularly peaceful and joyous time.
开普勒和特里克——以截然相反的方式——都亲身体验了秘书问题如何过度简化了寻找爱情的过程。在经典的秘书问题中,申请者总是会接受职位,从而避免了特里克遭遇的拒绝。而且,一旦被拒绝,就无法被“召回”,这与开普勒所采取的策略相反。
Both Kepler and Trick—in opposite ways—experienced firsthand some of the ways that the secretary problem oversimplifies the search for love. In the classical secretary problem, applicants always accept the position, preventing the rejection experienced by Trick. And they cannot be “recalled” once passed over, contrary to the strategy followed by Kepler.
秘书问题提出后的几十年里,人们研究了各种各样的类似场景,并制定了在各种不同条件下实现最优停止的策略。例如,被拒绝的可能性有一个简单的数学解决方案:尽早并经常提出建议。如果你被拒绝的概率是 50%,那么得出 37% 规则的同一数学分析表明,你应该在搜索了四分之一之后就开始提出建议。如果被拒绝,继续向你看到的每个最优秀的人提出建议,直到有人接受。采用这样的策略,你整体成功的几率——也就是说,向候选人池中的最佳人选提出建议并被其接受——也将是 25%。对于将拒绝的障碍与一开始就确定一个人的标准这一普遍困难结合在一起的场景来说,这个几率可能并不算太糟糕。
In the decades since the secretary problem was first introduced, a wide range of variants on the scenario have been studied, with strategies for optimal stopping worked out under a number of different conditions. The possibility of rejection, for instance, has a straightforward mathematical solution: propose early and often. If you have, say, a 50/50 chance of being rejected, then the same kind of mathematical analysis that yielded the 37% Rule says you should start making offers after just a quarter of your search. If turned down, keep making offers to every best-yet person you see until somebody accepts. With such a strategy, your chance of overall success—that is, proposing and being accepted by the best applicant in the pool—will also be 25%. Not such terrible odds, perhaps, for a scenario that combines the obstacle of rejection with the general difficulty of establishing one’s standards in the first place.
开普勒则谴责了驱使他不断探索的“不安和怀疑”。他在给一位知己的信中哀叹道:“难道除了意识到许多其他愿望无法实现之外,我这颗不安的心就没有其他方式可以安于命运了吗?” 在这里,最优停止理论再次提供了一定程度的安慰。不安和怀疑并非道德或心理堕落的标志,实际上,它们是在可能获得第二次机会的情况下采取的最佳策略的一部分。如果你还记得之前的申请者,你会发现最优算法对人们熟悉的“先看后走”规则进行了改进:更长的犹豫期和后备计划。
Kepler, for his part, decried the “restlessness and doubtfulness” that pushed him to keep on searching. “Was there no other way for my uneasy heart to be content with its fate,” he bemoaned in a letter to a confidante, “than by realizing the impossibility of the fulfillment of so many other desires?” Here, again, optimal stopping theory provides some measure of consolation. Rather than being signs of moral or psychological degeneracy, restlessness and doubtfulness actually turn out to be part of the best strategy for scenarios where second chances are possible. If you can recall previous applicants, the optimal algorithm puts a twist on the familiar Look-Then-Leap Rule: a longer noncommittal period, and a fallback plan.
例如,假设立即求婚是万无一失的,但迟到的求婚有一半的几率会被拒绝。那么,根据数学公式,你应该继续含糊其辞地寻找,直到你看过61%的申请者,然后只有当剩下的39%中有人被证明是迄今为止最优秀的人时,你才会做出决定。如果你在考虑了所有可能性之后仍然单身——就像开普勒一样——那么就回到那个被拒绝的最佳人选。策略和结果之间的对称性在这种情况下再次成立,在允许第二次机会的情况下,你最终找到最佳申请人的几率仍然是61%。
For example, assume an immediate proposal is a sure thing but belated proposals are rejected half the time. Then the math says you should keep looking noncommittally until you’ve seen 61% of applicants, and then only leap if someone in the remaining 39% of the pool proves to be the best yet. If you’re still single after considering all the possibilities—as Kepler was—then go back to the best one that got away. The symmetry between strategy and outcome holds in this case once again, with your chances of ending up with the best applicant under this second-chances-allowed scenario also being 61%.
对开普勒来说,现实与经典秘书问题之间的差异带来了一个圆满的结局。事实上,对经典问题的这种解读对特里克来说也同样有效。拒绝之后,他完成了学业,并在德国找到了一份工作。在那里,他“走进一家酒吧,爱上了一位美丽的女子,三周后便同居了,[并]邀请她‘到美国住一段时间’”。她答应了——六年后,他们结婚了。
For Kepler, the difference between reality and the classical secretary problem brought with it a happy ending. In fact, the twist on the classical problem worked out well for Trick, too. After the rejection, he completed his degree and took a job in Germany. There, he “walked into a bar, fell in love with a beautiful woman, moved in together three weeks later, [and] invited her to live in the United States ‘for a while.’” She agreed—and six years later, they were wed.
看到好东西就知道它有多好:完整信息
Knowing a Good Thing When You See It: Full Information
我们考虑的第一组变体——拒绝和召回——改变了经典秘书问题的假设:及时的提议总会被接受,而迟到的提议则永远不会被接受。对于这些变体,最佳方法与原始方案相同:先不置可否地考虑一段时间,然后做好行动的准备。
The first set of variants we considered—rejection and recall—altered the classical secretary problem’s assumptions that timely proposals are always accepted, and tardy proposals, never. For these variants, the best approach remained the same as in the original: look noncommittally for a time, then be ready to leap.
但秘书问题中还有一个更基本的假设值得我们质疑。也就是说,在秘书问题中,除了申请人之间的比较之外,我们对他们一无所知。我们无法客观地或预先判断哪些申请人是好是坏;此外,当我们比较两个申请人时,我们知道哪个更好,但不知道好多少。正是这个事实导致了不可避免的“观察”阶段,在这个阶段,我们可能会错过一位优秀的早期申请人,同时调整我们的期望和标准。数学家将这类最优停止问题称为“无信息博弈”。
But there’s an even more fundamental assumption of the secretary problem that we might call into question. Namely, in the secretary problem we know nothing about the applicants other than how they compare to one another. We don’t have an objective or preexisting sense of what makes for a good or a bad applicant; moreover, when we compare two of them, we know which of the two is better, but not by how much. It’s this fact that gives rise to the unavoidable “look” phase, in which we risk passing up a superb early applicant while we calibrate our expectations and standards. Mathematicians refer to this genre of optimal stopping problems as “no-information games.”
这种设置与大多数寻找公寓、伴侣甚至秘书的搜索方式截然不同。想象一下,如果我们有某种客观标准——比如,假设每个秘书都参加过按百分位评分的打字考试,就像SAT、GRE或LSAT那样。也就是说,每个申请人的分数都会告诉我们他们在所有参加考试的打字员中处于什么位置:51%的打字员略高于平均水平,75%的打字员比四分之三的考生表现更好,等等。
This setup is arguably a far cry from most searches for an apartment, a partner, or even a secretary. Imagine instead that we had some kind of objective criterion—if every secretary, for instance, had taken a typing exam scored by percentile, in the fashion of the SAT or GRE or LSAT. That is, every applicant’s score will tell us where they fall among all the typists who took the test: a 51st-percentile typist is just above average, a 75th-percentile typist is better than three test takers out of four, and so on.
假设我们的申请者群体能够代表整个群体,并且没有任何偏差或自我选择。此外,假设我们认为打字速度是衡量申请者的唯一标准。那么,我们就拥有了数学家所说的“完整信息”,一切都会改变。正如1966年关于这个问题的开创性论文所述,“无需积累经验即可设定标准,有时可以立即做出有利可图的选择。”换句话说,如果一位95%的申请者恰好是我们评估的第一个人,我们会立即知道,并可以自信地当场录用她——当然,这是假设我们认为申请者群体中不存在96%的申请者。
Suppose that our applicant pool is representative of the population at large and isn’t skewed or self-selected in any way. Furthermore, suppose we decide that typing speed is the only thing that matters about our applicants. Then we have what mathematicians call “full information,” and everything changes. “No buildup of experience is needed to set a standard,” as the seminal 1966 paper on the problem put it, “and a profitable choice can sometimes be made immediately.” In other words, if a 95th-percentile applicant happens to be the first one we evaluate, we know it instantly and can confidently hire her on the spot—that is, of course, assuming we don’t think there’s a 96th-percentile applicant in the pool.
这就是问题所在。如果我们的目标仍然是找到最适合这份工作的人,我们仍然需要权衡是否存在更优秀的申请人。然而,我们掌握了充分的信息,这就为我们直接计算这些概率提供了一切。例如,下一位申请人处于 96% 或更高的概率永远是二十分之一。因此,是否停止的决定完全取决于我们还剩下多少申请人。充分的信息意味着我们不需要在行动前三思。我们可以改用阈值规则,如果申请人的水平高于某个百分位,我们就会立即接受她。我们不需要查看初始候选人组来设置这个阈值——但是,我们需要敏锐地意识到还有多少候选人可供选择。
And there’s the rub. If our goal is, again, to get the single best person for the job, we still need to weigh the likelihood that there’s a stronger applicant out there. However, the fact that we have full information gives us everything we need to calculate those odds directly. The chance that our next applicant is in the 96th percentile or higher will always be 1 in 20, for instance. Thus the decision of whether to stop comes down entirely to how many applicants we have left to see. Full information means that we don’t need to look before we leap. We can instead use the Threshold Rule, where we immediately accept an applicant if she is above a certain percentile. We don’t need to look at an initial group of candidates to set this threshold—but we do, however, need to be keenly aware of how much looking remains available.
数学表明,当求职者人数众多时,你应该放弃即使是非常优秀的求职者,以期找到比他更优秀的人——但随着选择范围缩小,你应该做好聘用任何略胜一筹的人的准备。这是一个熟悉的道理,即使并非完全鼓舞人心:面对有限的选择,降低标准。反过来也同样适用:鱼多则鱼多。在这两种情况下,至关重要的是,数学会告诉你究竟能降低多少。
The math shows that when there are a lot of applicants left in the pool, you should pass up even a very good applicant in the hopes of finding someone still better than that—but as your options dwindle, you should be prepared to hire anyone who’s simply better than average. It’s a familiar, if not exactly inspiring, message: in the face of slim pickings, lower your standards. It also makes clear the converse: with more fish in the sea, raise them. In both cases, crucially, the math tells you exactly by how much.
理解此场景下数字最简单的方法是从最后一位开始,然后反向思考。当然,如果只剩下最后一位申请人,你必然会选择她。但是,当你看到倒数第二位申请人时,问题就变成了:她的综合素质是否高于50%?如果是,那就聘用她;如果不是,那就应该把赌注押在倒数第二位申请人身上,因为根据定义,她高于50%的概率是50/50。同样,如果倒数第三位申请人的综合素质高于69%,你就应该选择她;如果倒数第四位申请人的综合素质高于78%,你就应该选择她,以此类推。剩下的申请人越多,你就越挑剔。无论如何,除非你完全没有选择,否则永远不要聘用低于平均水平的人。(而且,既然你仍然只想在众多申请人中找到最优秀的人才,那么永远不要聘用那些不是你目前见过的最优秀的人。)
The easiest way to understand the numbers for this scenario is to start at the end and think backward. If you’re down to the last applicant, of course, you are necessarily forced to choose her. But when looking at the next-to-last applicant, the question becomes: is she above the 50th percentile? If yes, then hire her; if not, it’s worth rolling the dice on the last applicant instead, since her odds of being above the 50th percentile are 50/50 by definition. Likewise, you should choose the third-to-last applicant if she’s above the 69th percentile, the fourth-to-last applicant if she’s above the 78th, and so on, being more choosy the more applicants are left. No matter what, never hire someone who’s below average unless you’re totally out of options. (And since you’re still interested only in finding the very best person in the applicant pool, never hire someone who isn’t the best you’ve seen so far.)
在这个完全信息版的秘书问题中,找到最佳申请人的概率为58%——虽然远非万无一失,但比无信息博弈中37%规则的成功率(37%)要高得多。如果你掌握了所有信息,即使申请人数量无限增长,你也能经常成功。
The chance of ending up with the single best applicant in this full-information version of the secretary problem comes to 58%—still far from a guarantee, but considerably better than the 37% success rate offered by the 37% Rule in the no-information game. If you have all the facts, you can succeed more often than not, even as the applicant pool grows arbitrarily large.
全信息秘书问题中的最佳停止阈值。
Optimal stopping thresholds in the full-information secretary problem.
因此,这场信息全覆盖的游戏提供了一个意想不到且略显怪诞的结论。淘金比追求爱情更容易成功。如果你根据任何客观标准(比如他们的收入百分位)来评估你的伴侣,那么你掌握的信息量远比追求模糊的情感反应(“爱情”)要多得多,因为后者可能需要经验和比较才能确定。
The full-information game thus offers an unexpected and somewhat bizarre takeaway. Gold digging is more likely to succeed than a quest for love. If you’re evaluating your partners based on any kind of objective criterion—say, their income percentile—then you’ve got a lot more information at your disposal than if you’re after a nebulous emotional response (“love”) that might require both experience and comparison to calibrate.
当然,你没必要非要以净资产——或者打字速度——作为衡量标准。任何能够充分体现申请人在总体人群中地位的标准,都会将“先看后看”规则转变为“门槛规则”,并大幅提升你在人群中找到最佳申请人的几率。
Of course, there’s no reason that net worth—or, for that matter, typing speed—needs to be the thing that you’re measuring. Any yardstick that provides full information on where an applicant stands relative to the population at large will change the solution from the Look-Then-Leap Rule to the Threshold Rule and will dramatically boost your chances of finding the single best applicant in the group.
秘书问题还有更多变体,它们修改了其他假设,或许能使其更贴近现实世界中寻找爱情(或秘书)的挑战。但从最优停顿中可以汲取的教训不仅限于约会或招聘。事实上,在选项一个接一个出现的情况下努力做出最佳选择,也是卖房、停车和见好就收的基本结构。而且,从某种程度上来说,它们都是已经解决的问题。
There are many more variants of the secretary problem that modify its other assumptions, perhaps bringing it more in line with the real-world challenges of finding love (or a secretary). But the lessons to be learned from optimal stopping aren’t limited to dating or hiring. In fact, trying to make the best choice when options only present themselves one by one is also the basic structure of selling a house, parking a car, and quitting when you’re ahead. And they’re all, to some degree or other, solved problems.
何时出售
When to Sell
如果我们再改变经典秘书问题的两个方面,我们就会发现自己从约会领域跃升到了房地产领域。之前我们讨论过租房是一个最优停止问题,但拥有一套房子同样也存在最优停止问题。
If we alter two more aspects of the classical secretary problem, we find ourselves catapulted from the realm of dating to the realm of real estate. Earlier we talked about the process of renting an apartment as an optimal stopping problem, but owning a home has no shortage of optimal stopping either.
想象一下出售一套房子。在咨询了几家房产经纪人后,你把房子挂牌出售;重新粉刷了一层,做了些景观美化,接下来就只剩下等待报价了。每收到一个报价,你通常都要决定是接受还是拒绝。但拒绝一个报价是有代价的——你需要再支付一周(甚至一个月)的房贷,等待下一个报价,而且下一个报价也不一定比你预期的更好。
Imagine selling a house, for instance. After consulting with several real estate agents, you put your place on the market; a new coat of paint, some landscaping, and then it’s just a matter of waiting for the offers to come in. As each offer arrives, you typically have to decide whether to accept it or turn it down. But turning down an offer comes at a cost—another week (or month) of mortgage payments while you wait for the next offer, which isn’t guaranteed to be any better.
卖房类似于完全信息游戏。我们知道报价的客观价值,这不仅告诉我们哪些报价比哪些报价更好,还能告诉我们好多少。此外,我们还掌握了市场的整体状况,这使我们能够至少粗略地预测预期的报价范围。(这为我们提供了与上述打字考试相同的关于每个报价的“百分位”信息。)然而,这里的区别在于,我们的目标实际上并非获得单个最优报价,而是在整个过程中赚取最多的钱。考虑到等待的成本是以金钱来衡量的,今天的好报价总比几个月后稍微好一点的报价要好。
Selling a house is similar to the full-information game. We know the objective dollar value of the offers, telling us not only which ones are better than which, but also by how much. What’s more, we have information about the broader state of the market, which enables us to at least roughly predict the range of offers to expect. (This gives us the same “percentile” information about each offer that we had with the typing exam above.) The difference here, however, is that our goal isn’t actually to secure the single best offer—it’s to make the most money through the process overall. Given that waiting has a cost measured in dollars, a good offer today beats a slightly better one several months from now.
有了这些信息,我们无需含糊其辞地设定门槛。相反,我们可以先设定一个门槛,忽略所有低于这个门槛的房产,然后选择第一个超过这个门槛的选项。当然,如果我们的积蓄有限,如果在某个时间点之前卖不出去,积蓄就会耗尽;或者我们预计只会收到有限数量的报价,之后也不会再有任何兴趣,那么我们应该在接近这些门槛时降低标准。(购房者寻找“积极”卖家是有原因的。)但如果这两种担忧都没有让我们认为自己已经走投无路,那么我们就可以专注于对等待的过程进行成本效益分析。
Having this information, we don’t need to look noncommittally to set a threshold. Instead, we can set one going in, ignore everything below it, and take the first option to exceed it. Granted, if we have a limited amount of savings that will run out if we don’t sell by a certain time, or if we expect to get only a limited number of offers and no more interest thereafter, then we should lower our standards as such limits approach. (There’s a reason why home buyers look for “motivated” sellers.) But if neither concern leads us to believe that our backs are against the wall, then we can simply focus on a cost-benefit analysis of the waiting game.
这里我们将分析一个最简单的情况:我们确切地知道报价会出现在哪个价格区间,并且该区间内所有报价的概率都相同。如果我们不必担心报价(或积蓄)耗尽,那么我们可以纯粹地考虑等待更好的报价预期会有什么收益或损失。如果我们拒绝当前的报价,那么出现更好报价的概率乘以我们预期的更优价格,是否足以弥补等待的成本?事实证明,这里的数学原理非常清晰,它为我们提供了一个明确的函数,将止损价作为等待报价的成本的函数。
Here we’ll analyze one of the simplest cases: where we know for certain the price range in which offers will come, and where all offers within that range are equally likely. If we don’t have to worry about the offers (or our savings) running out, then we can think purely in terms of what we can expect to gain or lose by waiting for a better deal. If we decline the current offer, will the chance of a better one, multiplied by how much better we expect it to be, more than compensate for the cost of the wait? As it turns out, the math here is quite clean, giving us an explicit function for stopping price as a function of the cost of waiting for an offer.
这个特定的数学结果并不关心你出售的是价值数百万美元的豪宅还是破旧的棚屋。它唯一关心的是你可能收到的最高报价和最低报价之间的差额。通过代入一些具体的数字,我们可以看到这个算法如何为我们提供大量明确的指导。例如,假设我们预期的报价范围从 40 万美元到 50 万美元。首先,如果等待的成本微不足道,我们几乎可以无限地挑剔。如果获得另一个报价的成本只有一美元,那么我们将通过等待愿意出价 499,552.79 美元而不是更低的人来最大化我们的收益。如果等待一个报价的成本是 2,000 美元,我们应该坚持等待一个 480,000 美元的报价。在一个低迷的市场中,等待一个报价的成本是 10,000 美元,我们应该接受任何超过 455,279 美元的报价。最后,如果等待的成本相当于我们预期报价范围的一半或更多——在本例中是5万美元——那么坚持下去就毫无意义了;我们最好的选择是接受第一个出现的报价,然后就此了结。乞丐不能挑肥拣瘦。
This particular mathematical result doesn’t care whether you’re selling a mansion worth millions or a ramshackle shed. The only thing it cares about is the difference between the highest and lowest offers you’re likely to receive. By plugging in some concrete figures, we can see how this algorithm offers us a considerable amount of explicit guidance. For instance, let’s say the range of offers we’re expecting runs from $400,000 to $500,000. First, if the cost of waiting is trivial, we’re able to be almost infinitely choosy. If the cost of getting another offer is only a dollar, we’ll maximize our earnings by waiting for someone willing to offer us $499,552.79 and not a dime less. If waiting costs $2,000 an offer, we should hold out for an even $480,000. In a slow market where waiting costs $10,000 an offer, we should take anything over $455,279. Finally, if waiting costs half or more of our expected range of offers—in this case, $50,000—then there’s no advantage whatsoever to holding out; we’ll do best by taking the very first offer that comes along and calling it done. Beggars can’t be choosers.
房屋销售问题中的最佳停止阈值。
Optimal stopping thresholds in the house-selling problem.
这个问题中需要注意的关键点是,我们的阈值仅取决于搜索成本。由于下一个报价是好报价的概率(以及找到该报价的成本)始终不变,因此无论运气如何,我们的止损价都不会随着搜索的进行而降低。我们在开始之前就设定了一次,然后就一直保持下去。
The critical thing to note in this problem is that our threshold depends only on the cost of search. Since the chances of the next offer being a good one—and the cost of finding out—never change, our stopping price has no reason to ever get lower as the search goes on, regardless of our luck. We set it once, before we even begin, and then we quite simply hold fast.
威斯康星大学麦迪逊分校的优化专家劳拉·艾伯特·麦克莱回忆起自己在出售房屋时,曾运用过最优停止问题的知识。她解释说:“我们收到的第一个报价很棒,但成本太高,因为他们想让我们提前一个月搬走。还有一个竞争性报价……[但]我们只是坚持到收到合适的报价。” 对许多卖家来说,拒绝一两个不错的报价可能会让人感到紧张,尤其是如果接下来的报价也同样不理想的话。但麦克莱坚持自己的立场,保持冷静。她承认:“如果我不知道数学计算结果对我有利,那真的非常非常困难。”
The University of Wisconsin–Madison’s Laura Albert McLay, an optimization expert, recalls turning to her knowledge of optimal stopping problems when it came time to sell her own house. “The first offer we got was great,” she explains, “but it had this huge cost because they wanted us to move out a month before we were ready. There was another competitive offer … [but] we just kind of held out until we got the right one.” For many sellers, turning down a good offer or two can be a nerve-racking proposition, especially if the ones that immediately follow are no better. But McLay held her ground and stayed cool. “That would have been really, really hard,” she admits, “if I didn’t know the math was on my side.”
这一原则适用于任何你收到一系列录用通知,并需要付出成本来寻找或等待下一个录用通知的情况。因此,它与许多远不止卖房的案例息息相关。例如,经济学家曾用这一算法来模拟人们如何寻找工作,并巧妙地解释了失业工人和职位空缺同时存在这一看似矛盾的事实。
This principle applies to any situation where you get a series of offers and pay a cost to seek or wait for the next. As a consequence, it’s relevant to cases that go far beyond selling a house. For example, economists have used this algorithm to model how people look for jobs, where it handily explains the otherwise seemingly paradoxical fact of unemployed workers and unfilled vacancies existing at the same time.
事实上,这些最优停止问题的变体还有另一个更令人惊讶的特性。正如我们所见,在开普勒寻找爱情的过程中,“回忆”过去机会的能力至关重要。但在卖房和找工作的过程中,即使有可能重新考虑之前的录用通知,即使该通知保证仍然有效,你也永远不应该这样做。如果它当时没有超出你的底线,那么现在也不会超过你的底线。你为继续寻找而付出的代价是沉没成本。不要妥协,不要犹豫。也不要回头。
In fact, these variations on the optimal stopping problem have another, even more surprising property. As we saw, the ability to “recall” a past opportunity was vital in Kepler’s quest for love. But in house selling and job hunting, even if it’s possible to reconsider an earlier offer, and even if that offer is guaranteed to still be on the table, you should nonetheless never do so. If it wasn’t above your threshold then, it won’t be above your threshold now. What you’ve paid to keep searching is a sunk cost. Don’t compromise, don’t second-guess. And don’t look back.
何时停车
When to Park
我发现校园里的三大管理问题是学生的性问题、校友的体育运动问题和教职工的停车问题。
I find that the three major administrative problems on a campus are sex for the students, athletics for the alumni, and parking for the faculty.
——克拉克·克尔,加州大学伯克利分校校长,1958-1967
—CLARK KERR, PRESIDENT OF UC BERKELEY, 1958–1967
另一个存在大量最优停车问题的领域——也是通常不建议回头考虑的领域——是汽车。一些最早关于秘书问题的文献中就提到了驾驶员,而持续向前运动的框架使得几乎每一次驾车出行决策都变成了停车问题:寻找餐厅;寻找卫生间;以及对城市驾驶员来说最为棘手的寻找停车位。还有谁比被《洛杉矶时报》誉为“停车摇滚明星”的加州大学洛杉矶分校杰出城市规划教授唐纳德·舒普更适合谈论停车的方方面面呢?我们从北加州开车去拜访他,并向舒普保证我们会留出充足的时间应对意外的交通拥堵。“至于如何应对‘意外交通拥堵’,我认为你应该为预期交通拥堵做好计划,”他回答道。舒普最著名的著作可能是《免费停车的高昂成本》,他为推动人们讨论和理解驾车到达目的地时究竟发生了什么做出了巨大贡献。
Another domain where optimal stopping problems abound—and where looking back is also generally ill-advised—is the car. Motorists feature in some of the earliest literature on the secretary problem, and the framework of constant forward motion makes almost every car-trip decision into a stopping problem: the search for a restaurant; the search for a bathroom; and, most acutely for urban drivers, the search for a parking space. Who better to talk to about the ins and outs of parking than the man described by the Los Angeles Times as “the parking rock star,” UCLA Distinguished Professor of Urban Planning Donald Shoup? We drove down from Northern California to visit him, reassuring Shoup that we’d be leaving plenty of time for unexpected traffic. “As for planning on ‘unexpected traffic,’ I think you should plan on expected traffic,” he replied. Shoup is perhaps best known for his book The High Cost of Free Parking, and he has done much to advance the discussion and understanding of what really happens when someone drives to their destination.
我们应该同情那些可怜的司机。正如舒普所建模的那样,理想的停车位能够在停车位的“标价”、步行的时间和不便性、寻找停车位所需的时间(会因目的地、时间等因素而有很大差异)以及寻找停车位所需的油耗之间实现精确的平衡。这个等式会随着车内乘客人数的变化而变化,乘客可以分摊停车位的成本,但不能分摊寻找停车位的时间或步行时间。同时,司机需要考虑到,停车位供应最多的区域也可能是需求最大的区域;停车本身就带有博弈论的成分,因为你试图智胜路上的其他司机,而他们反过来也在试图智胜你。*话虽如此,停车的许多挑战可以归结为一个数字:占用率。这是当前所有停车位中被占用的比例。如果占用率低,就很容易找到一个好的停车位。如果车位很高,那么找个地方停车就很困难了。
We should pity the poor driver. The ideal parking space, as Shoup models it, is one that optimizes a precise balance between the “sticker price” of the space, the time and inconvenience of walking, the time taken seeking the space (which varies wildly with destination, time of day, etc.), and the gas burned in doing so. The equation changes with the number of passengers in the car, who can split the monetary cost of a space but not the search time or the walk. At the same time, the driver needs to consider that the area with the most parking supply may also be the area with the most demand; parking has a game-theoretic component, as you try to outsmart the other drivers on the road while they in turn are trying to outsmart you.* That said, many of the challenges of parking boil down to a single number: the occupancy rate. This is the proportion of all parking spots that are currently occupied. If the occupancy rate is low, it’s easy to find a good parking spot. If it’s high, finding anywhere at all to park is a challenge.
舒普认为,许多停车难题源于城市实施的政策,这些政策导致停车位占用率过高。如果某个地方的停车费太低(或者——糟糕!——完全免费),人们就会更有动力把车停在那里,而不是停得远一点再步行。所以每个人都想把车停在那里,但大多数人发现车位已经满了,人们最终只能浪费时间,燃烧化石燃料,四处寻找车位。
Shoup argues that many of the headaches of parking are consequences of cities adopting policies that result in extremely high occupancy rates. If the cost of parking in a particular location is too low (or—horrors!—nothing at all), then there is a high incentive to park there, rather than to park a little farther away and walk. So everybody tries to park there, but most of them find the spaces are already full, and people end up wasting time and burning fossil fuel as they cruise for a spot.
Shoup 的解决方案是安装数字停车计费器,能够根据需求调整价格。(目前,旧金山市中心已开始实施这项方案。)价格的制定考虑了目标占用率,Shoup 认为这个占用率应该在 85% 左右——相比大多数大城市几乎 100% 的路边停车位拥堵,这是一个巨大的下降。他指出,当占用率从 90% 上升到 95% 时,车辆数量只会增加 5%,但每个人的搜索时间都会加倍。
Shoup’s solution involves installing digital parking meters that are capable of adaptive prices that rise with demand. (This has now been implemented in downtown San Francisco.) The prices are set with a target occupancy rate in mind, and Shoup argues that this rate should be somewhere around 85%—a radical drop from the nearly 100%-packed curbs of most major cities. As he notes, when occupancy goes from 90% to 95%, it accommodates only 5% more cars but doubles the length of everyone’s search.
一旦我们认识到停车是一个最优停车问题,占用率对停车策略的关键影响就变得清晰起来。当你沿着街道行驶时,每当你偶尔看到空位,你就必须做出决定:是占据这个位置,还是靠近目的地碰碰运气?
The key impact that occupancy rate has on parking strategy becomes clear once we recognize that parking is an optimal stopping problem. As you drive along the street, every time you see the occasional empty spot you have to make a decision: should you take this spot, or go a little closer to your destination and try your luck?
假设你行驶在一条无限长的道路上,停车位均匀分布,你的目标是尽量缩短步行到目的地的距离。那么解决方案就是“先看后走”原则。最佳停车方式的驾驶员应该放弃所有距离目的地超过一定距离的空位,然后占据之后出现的第一个空位。从“先看后走”切换到“走”的距离取决于可能被占满的停车位比例——即占用率。下一页的表格给出了一些代表性比例下的距离。
Assume you’re on an infinitely long road, with parking spots evenly spaced, and your goal is to minimize the distance you end up walking to your destination. Then the solution is the Look-Then-Leap Rule. The optimally stopping driver should pass up all vacant spots occurring more than a certain distance from the destination and then take the first space that appears thereafter. And the distance at which to switch from looking to leaping depends on the proportion of spots that are likely to be filled—the occupancy rate. The table on the next page gives the distances for some representative proportions.
如何最佳地找到停车位。
How to optimally find parking.
如果这条无尽街道的停车位入住率达到大城市水平的99%,只有1%的空置停车位,那么你应该选择距离目的地近70个停车位(超过四分之一英里)的第一个停车位。但如果Shoup如愿以偿,入住率降至只有85%,那么你不用再认真寻找停车位,除非你走了半个街区。
If this infinite street has a big-city occupancy rate of 99%, with just 1% of spots vacant, then you should take the first spot you see starting at almost 70 spots—more than a quarter mile—from your destination. But if Shoup has his way and occupancy rates drop to just 85%, you don’t need to start seriously looking until you’re half a block away.
我们大多数人不会在笔直、无限长的道路上行驶。因此,与其他最优停车问题一样,研究人员考虑对这一基本场景进行各种调整。例如,他们研究了以下情况下的最优停车策略:驾驶员可以掉头;距离目的地越近,可用停车位越少;以及驾驶员与前往同一目的地的其他驾驶员竞争。但无论问题的具体参数如何,更多的空置停车位总是会让生活更轻松。这对市政府来说是一个政策提醒:停车并非仅仅拥有资源(停车位)并最大化其利用率(占用率)那么简单。停车也是一个过程——一个最优停车问题——它会消耗注意力、时间和燃料,并产生污染和拥堵。正确的策略可以解决整个问题。而且,与直觉相反,在非常理想的街区出现空置停车位可能表明一切运行正常。
Most of us don’t drive on perfectly straight, infinitely long roads. So as with other optimal stopping problems, researchers have considered a variety of tweaks to this basic scenario. For instance, they have studied the optimal parking strategy for cases where the driver can make U-turns, where fewer parking spaces are available the closer one gets to the destination, and where the driver is in competition against rival drivers also heading to the same destination. But whatever the exact parameters of the problem, more vacant spots are always going to make life easier. It’s something of a policy reminder to municipal governments: parking is not as simple as having a resource (spots) and maximizing its utilization (occupancy). Parking is also a process—an optimal stopping problem—and it’s one that consumes attention, time, and fuel, and generates both pollution and congestion. The right policy addresses the whole problem. And, counterintuitively, empty spots on highly desirable blocks can be the sign that things are working correctly.
我们问舒普,他的研究是否能让他优化通勤,穿过洛杉矶的交通拥堵,到达他在加州大学洛杉矶分校的办公室。这位堪称世界顶级停车专家是否掌握了某种秘密武器?
We asked Shoup if his research allows him to optimize his own commute, through the Los Angeles traffic to his office at UCLA. Does arguably the world’s top expert on parking have some kind of secret weapon?
他确实骑自行车。
He does: “I ride my bike.”
何时退出
When to Quit
1997年,《福布斯》杂志将鲍里斯·别列佐夫斯基评为俄罗斯首富,身价约30亿美元。就在十年前,他还靠着苏联科学院数学家的薪水过活。他利用自己在研究中建立的行业关系,创办了一家促进外国汽车制造商与苏联汽车制造商伏尔加汽车公司(AvtoVAZ)互动的公司,积累了数十亿美元的财富。别列佐夫斯基的公司后来成为伏尔加汽车公司的大型经销商,并利用分期付款模式,利用卢布的恶性通货膨胀获利。他利用合作所得资金,先后收购了伏尔加汽车公司的部分股权,随后又收购了ORT电视台,最终收购了西伯利亚石油公司。作为新一代寡头的一员,他积极参与政治,支持鲍里斯·叶利钦1996年连任,并于1999年推举弗拉基米尔·普京为其继任者。
In 1997, Forbes magazine identified Boris Berezovsky as the richest man in Russia, with a fortune of roughly $3 billion. Just ten years earlier he had been living on a mathematician’s salary from the USSR Academy of Sciences. He made his billions by drawing on industrial relationships he’d formed through his research to found a company that facilitated interaction between foreign carmakers and the Soviet car manufacturer AvtoVAZ. Berezovky’s company then became a large-scale dealer for the cars that AvtoVAZ produced, using a payment installment scheme to take advantage of hyperinflation in the ruble. Using the funds from this partnership he bought partial ownership of AvtoVAZ itself, then the ORT Television network, and finally the Sibneft oil company. Becoming one of a new class of oligarchs, he participated in politics, supporting Boris Yeltsin’s re-election in 1996 and the choice of Vladimir Putin as his successor in 1999.
但就在那时,别列佐夫斯基的时运突然转变。普京当选后不久,别列佐夫斯基公开反对拟议的宪法改革,该改革将扩大总统权力。他持续不断的公开批评普京,导致两人关系恶化。2000年10月,当普京被问及别列佐夫斯基的批评时,他回答道:“国家手里拿着一根棍子,你只能用它打一下,但要打在头上。我们还没有用过这根棍子……等到我们真正愤怒的那一天,我们不会犹豫。” 别列佐夫斯基于次月永久离开俄罗斯,流亡英国,并继续在那里批评普京政权。
But that’s when Berezovsky’s luck turned. Shortly after Putin’s election, Berezovsky publicly objected to proposed constitutional reforms that would expand the power of the president. His continued public criticism of Putin led to the deterioration of their relationship. In October 2000, when Putin was asked about Berezovsky’s criticisms, he replied, “The state has a cudgel in its hands that you use to hit just once, but on the head. We haven’t used this cudgel yet.… The day we get really angry, we won’t hesitate.” Berezovsky left Russia permanently the next month, taking up exile in England, where he continued to criticize Putin’s regime.
别列佐夫斯基是如何决定离开俄罗斯的?或许,我们可以用数学的方式思考“见好就收”这句话?别列佐夫斯基本人或许也思考过这个问题,因为他多年前作为数学家研究的课题正是最优停止问题;他还撰写了第一本(也是迄今为止唯一一本)专门探讨秘书问题的著作。
How did Berezovsky decide it was time to leave Russia? Is there a way, perhaps, to think mathematically about the advice to “quit while you’re ahead”? Berezovsky in particular might have considered this very question himself, since the topic he had worked on all those years ago as a mathematician was none other than optimal stopping; he authored the first (and, so far, the only) book entirely devoted to the secretary problem.
“见好就收”的问题已经被以多种不同的形式进行了分析,但或许最适合别列佐夫斯基案例的——先向俄罗斯寡头们致歉——是所谓的“窃贼问题”。在这个问题中,一个窃贼有机会进行一系列抢劫。每次抢劫都会获得一些奖励,而且每次都有逃脱的几率。但如果窃贼被抓,他就会被捕并失去所有累积的收益。他应该遵循什么算法来最大化他的预期收益?
The problem of quitting while you’re ahead has been analyzed under several different guises, but perhaps the most appropriate to Berezovsky’s case—with apologies to Russian oligarchs—is known as the “burglar problem.” In this problem, a burglar has the opportunity to carry out a sequence of robberies. Each robbery provides some reward, and there’s a chance of getting away with it each time. But if the burglar is caught, he gets arrested and loses all his accumulated gains. What algorithm should he follow to maximize his expected take?
这个问题居然有解,这对抢劫电影剧本来说可是个坏消息:当团队试图引诱老贼重出江湖做最后一件事时,精明的小偷只需计算一下数字即可。而且,结果也相当直观:你应该进行的抢劫次数大致等于你逃脱的概率除以你被抓的概率。如果你是个技术娴熟的窃贼,每次抢劫都有90%的概率成功(而失去所有财物的概率为10%),那么在完成90/10=9次抢劫后就退休吧。一个笨手笨脚的业余爱好者,成功率只有50/50?第一次你没什么可失去的,但不要再冒险了。
The fact that this problem has a solution is bad news for heist movie screenplays: when the team is trying to lure the old burglar out of retirement for one last job, the canny thief need only crunch the numbers. Moreover, the results are pretty intuitive: the number of robberies you should carry out is roughly equal to the chance you get away, divided by the chance you get caught. If you’re a skilled burglar and have a 90% chance of pulling off each robbery (and a 10% chance of losing it all), then retire after 90/10 = 9 robberies. A ham-fisted amateur with a 50/50 chance of success? The first time you have nothing to lose, but don’t push your luck more than once.
尽管别列佐夫斯基精通最优停止理论,他的故事却以悲伤的结局收场。2013年3月,他去世了,一名保镖在他位于伯克郡的家中上锁的浴室里发现他,脖子上缠着绷带。验尸官的官方结论是,他上吊自杀,此前他卷入了一系列与俄罗斯敌人有关的高调诉讼,损失了大量财富。或许他应该早点收手——比如,积攒几千万美元,不要涉足政坛。可惜,这可不是他的风格。他的一位数学家朋友列昂尼德·博古斯拉夫斯基讲了一个关于别列佐夫斯基的故事,当时他们都是年轻的研究人员:在一次去莫斯科附近一个湖泊的滑水旅行中,他们计划使用的船坏了。大卫·霍夫曼在他的著作《寡头》中是这样讲述的:
Despite his expertise in optimal stopping, Berezovsky’s story ends sadly. He died in March 2013, found by a bodyguard in the locked bathroom of his house in Berkshire with a ligature around his neck. The official conclusion of a postmortem examination was that he had committed suicide, hanging himself after losing much of his wealth through a series of high-profile legal cases involving his enemies in Russia. Perhaps he should have stopped sooner—amassing just a few tens of millions of dollars, say, and not getting into politics. But, alas, that was not his style. One of his mathematician friends, Leonid Boguslavsky, told a story about Berezovsky from when they were both young researchers: on a water-skiing trip to a lake near Moscow, the boat they had planned to use broke down. Here’s how David Hoffman tells it in his book The Oligarchs:
朋友们去海滩点篝火时,博古斯拉夫斯基和别列佐夫斯基前往码头,试图修理发动机……三个小时后,他们把发动机拆开又重新组装好。发动机仍然没电。他们错过了大部分派对,但别列佐夫斯基坚持要继续尝试。“我们试了各种办法,”博古斯拉夫斯基回忆道。别列佐夫斯基不肯放弃。
While their friends went to the beach and lit a bonfire, Boguslavsky and Berezovsky headed to the dock to try to repair the motor.… Three hours later, they had taken apart and reassembled the motor. It was still dead. They had missed most of the party, yet Berezovsky insisted they had to keep trying. “We tried this and that,” Boguslavsky recalled. Berezovsky would not give up.
令人惊讶的是,永不放弃——永远不放弃——也出现在最优停止规则的文献中。从我们讨论的广泛问题来看,这似乎并非如此,但确实存在一些序贯决策问题,它们没有最优停止规则。一个简单的例子就是“三倍或零”的游戏。假设你有 1 美元,可以随意玩以下游戏:押上所有资金,有 50% 的机会获得三倍的收益,也有 50% 的机会输掉全部本金。你应该玩多少次?尽管这个问题很简单,但它没有最优停止规则,因为每次玩,你的平均收益都会略高一些。从 1 美元开始,一半情况下你会得到 3 美元,一半情况下会得到 0 美元,所以平均而言,你预计第一轮结束时你的口袋里会有 1.5 美元。然后,如果你在第一轮运气好,你刚刚赢得的3美元可能有两种结果:9美元和0美元——第二轮平均回报4.5美元。数学表明你应该一直玩下去。但如果你遵循这种策略,最终你会输光所有钱。有些问题与其解决,不如避免。
Surprisingly, not giving up—ever—also makes an appearance in the optimal stopping literature. It might not seem like it from the wide range of problems we have discussed, but there are sequential decision-making problems for which there is no optimal stopping rule. A simple example is the game of “triple or nothing.” Imagine you have $1.00, and can play the following game as many times as you want: bet all your money, and have a 50% chance of receiving triple the amount and a 50% chance of losing your entire stake. How many times should you play? Despite its simplicity, there is no optimal stopping rule for this problem, since each time you play, your average gains are a little higher. Starting with $1.00, you will get $3.00 half the time and $0.00 half the time, so on average you expect to end the first round with $1.50 in your pocket. Then, if you were lucky in the first round, the two possibilities from the $3.00 you’ve just won are $9.00 and $0.00—for an average return of $4.50 from the second bet. The math shows that you should always keep playing. But if you follow this strategy, you will eventually lose everything. Some problems are better avoided than solved.
永远停下来
Always Be Stopping
我预计此生仅此一次。因此,任何我能做的善事,或任何我能对同胞展现的仁慈,请让我现在就去做。让我不要拖延或忽视,因为我不会再走这条路了。
I expect to pass through this world but once. Any good therefore that I can do, or any kindness that I can show to any fellow creature, let me do it now. Let me not defer or neglect it, for I shall not pass this way again.
—斯蒂芬·格雷莱特
—STEPHEN GRELLET
花一下午的时间。你不能把它带走。
Spend the afternoon. You can’t take it with you.
—安妮·迪拉德
—ANNIE DILLARD
我们研究了人们在生活中遇到“停止”问题的具体案例,显然,我们大多数人每天都会以各种形式遇到这类问题。无论是秘书、未婚夫(妻)还是公寓,生活中都充满了“最佳停止”的现象。因此,一个不容忽视的问题是,我们究竟是出于进化、教育还是直觉,才遵循了最佳策略。
We’ve looked at specific cases of people confronting stopping problems in their lives, and it’s clear that most of us encounter these kinds of problems, in one form or another, daily. Whether it involves secretaries, fiancé(e)s, or apartments, life is full of optimal stopping. So the irresistible question is whether—by evolution or education or intuition—we actually do follow the best strategies.
乍一看,答案是否定的。大约有十几项研究得出了相同的结论:人们倾向于提前终止,从而错失了更优秀的申请者。为了更好地理解这些发现,我们采访了加州大学河滨分校的阿姆农·拉波波特 (Amnon Rapoport),他已经在实验室里进行了四十多年的最优终止实验。
At first glance, the answer is no. About a dozen studies have produced the same result: people tend to stop early, leaving better applicants unseen. To get a better sense for these findings, we talked to UC Riverside’s Amnon Rapoport, who has been running optimal stopping experiments in the laboratory for more than forty years.
与经典秘书问题最为接近的研究是由拉波波特(Rapoport)及其合作者达里尔·西尔(Darryl Seale)在20世纪90年代进行的。在这项研究中,受试者多次重复秘书问题,每次有40或80名申请人。受试者找到最佳候选人的总体成功率相当高:约为31%,与最佳的37%相差不远。大多数人的行为符合“先看后走”原则,但超过五分之四的时间,他们的行动比预期要早。
The study that most closely follows the classical secretary problem was run in the 1990s by Rapoport and his collaborator Darryl Seale. In this study people went through numerous repetitions of the secretary problem, with either 40 or 80 applicants each time. The overall rate at which people found the best possible applicant was pretty good: about 31%, not far from the optimal 37%. Most people acted in a way that was consistent with the Look-Then-Leap Rule, but they leapt sooner than they should have more than four-fifths of the time.
拉波波特告诉我们,他在生活中解决最优停止问题时也牢记这一点。比如,在找公寓时,他会克制自己想要快速做出决定的冲动。“尽管我天生缺乏耐心,而且很想买第一套公寓,但我还是努力控制自己!”
Rapoport told us that he keeps this in mind when solving optimal stopping problems in his own life. In searching for an apartment, for instance, he fights his own urge to commit quickly. “Despite the fact that by nature I am very impatient and I want to take the first apartment, I try to control myself!”
但这种不耐烦暗示了传统秘书问题中未考虑的另一个因素:时间的作用。毕竟,在你寻找秘书的整个过程中,你并没有秘书。更重要的是,你花了一整天的时间进行面试,而不是完成自己的工作。
But that impatience suggests another consideration that isn’t taken into account in the classical secretary problem: the role of time. After all, the whole time you’re searching for a secretary, you don’t have a secretary. What’s more, you’re spending the day conducting interviews instead of getting your own work done.
这种成本或许可以解释为什么人们在实验室解决秘书问题时会提前停止。Seale 和 Rapoport 指出,如果设想查看每位求职者的成本是找到最佳秘书成本的 1%,那么最佳策略就与人们在实验中实际从“查看”转向“跳跃”的策略完全一致。
This type of cost offers a potential explanation for why people stop early when solving a secretary problem in the lab. Seale and Rapoport showed that if the cost of seeing each applicant is imagined to be, for instance, 1% of the value of finding the best secretary, then the optimal strategy would perfectly align with where people actually switched from looking to leaping in their experiment.
令人费解的是,在Seale和Rapoport的研究中,搜索并无成本。那么,实验室里的人为什么会表现得好像搜索有成本呢?
The mystery is that in Seale and Rapoport’s study, there wasn’t a cost for search. So why might people in the laboratory be acting like there was one?
因为对人们来说,时间总是有成本的。它不是来自实验的设计,而是来自人们的生活。
Because for people there’s always a time cost. It doesn’t come from the design of the experiment. It comes from people’s lives.
因此,最优停止模型通常无法捕捉到搜索的“内生”时间成本,这或许可以解释为什么人类的决策经常偏离这些模型的预期。正如最优停止模型研究员尼尔·比尔登所说:“搜索一段时间后,我们人类往往会感到无聊。感到无聊并非不合理,但很难对其进行严格的建模。”
The “endogenous” time costs of searching, which aren’t usually captured by optimal stopping models, might thus provide an explanation for why human decision-making routinely diverges from the prescriptions of those models. As optimal stopping researcher Neil Bearden puts it, “After searching for a while, we humans just tend to get bored. It’s not irrational to get bored, but it’s hard to model that rigorously.”
但这并不意味着最优停止问题就不那么重要了;事实上,它反而使它们变得更加重要,因为时间的流逝将所有决策都变成了最优停止。
But this doesn’t make optimal stopping problems less important; it actually makes them more important, because the flow of time turns all decision-making into optimal stopping.
“最优停止理论关注的是选择采取特定行动的时机,”权威的最优停止教科书开篇即如此写道。很难想出比这更简洁的描述来描述人类的处境。我们当然会决定买入股票的时机和卖出股票的时机;但我们也会决定在合适的时机打开我们为特殊场合准备的那瓶酒,在合适的时机打断别人,在合适的时机亲吻别人。
“The theory of optimal stopping is concerned with the problem of choosing a time to take a given action,” opens the definitive textbook on optimal stopping, and it’s hard to think of a more concise description of the human condition. We decide the right time to buy stocks and the right time to sell them, sure; but also the right time to open the bottle of wine we’ve been keeping around for a special occasion, the right moment to interrupt someone, the right moment to kiss them.
从这个角度来看,秘书问题最根本却又最令人难以置信的假设——其严格的连续性,其不可阻挡的单行道——被揭示为时间本身的本质。因此,最优停车问题的显性前提正是生命意义的隐性前提。正是这一点迫使我们根据尚未预见的可能性做出决策,迫使我们即使在采取最优行动时也要接受高失败率。任何选择都不会重现。我们或许会再次做出类似的选择,但绝不会做出完全相同的选择。犹豫——不作为——与行动一样不可挽回。被困在单行道上的驾驶员之于空间,正如我们之于四维空间:我们真正地走过这条路只有一次。
Viewed this way, the secretary problem’s most fundamental yet most unbelievable assumption—its strict seriality, its inexorable one-way march—is revealed to be the nature of time itself. As such, the explicit premise of the optimal stopping problem is the implicit premise of what it is to be alive. It’s this that forces us to decide based on possibilities we’ve not yet seen, this that forces us to embrace high rates of failure even when acting optimally. No choice recurs. We may get similar choices again, but never that exact one. Hesitation—inaction—is just as irrevocable as action. What the motorist, locked on the one-way road, is to space, we are to the fourth dimension: we truly pass this way but once.
直觉上,我们认为理性决策意味着详尽地列举所有选项,仔细权衡每个选项,然后选出最佳方案。但在实践中,当时间紧迫时,决策(或更广泛意义上的思考)中很少有哪个方面比这一点更重要:何时停止。
Intuitively, we think that rational decision-making means exhaustively enumerating our options, weighing each one carefully, and then selecting the best. But in practice, when the clock—or the ticker—is ticking, few aspects of decision-making (or of thinking more generally) are as important as this one: when to stop.
*我们用粗体表示整本书中出现的算法。
*We use boldface to indicate the algorithms that appear throughout the book.
*采用这种策略,我们有33%的风险被最佳申请人拒之门外,16%的风险永远见不到她。具体来说,这三位申请人的排序可能恰好有六种:1-2-3、1-3-2、2-1-3、2-3-1、3-1-2和3-2-1。如果采用先看第一位申请人,然后看谁的排序更胜一筹的策略,那么在六种情况中的三种(2-1-3、2-3-1、3-1-2)中会成功,而在另外三种情况中会失败——两次是因为过于挑剔(1-2-3、1-3-2),一次是因为不够挑剔(3-2-1)。
*With this strategy we have a 33% risk of dismissing the best applicant and a 16% risk of never meeting her. To elaborate, there are exactly six possible orderings of the three applicants: 1-2-3, 1-3-2, 2-1-3, 2-3-1, 3-1-2, and 3-2-1. The strategy of looking at the first applicant and then leaping for whoever surpasses her will succeed in three of the six cases (2-1-3, 2-3-1, 3-1-2) and will fail in the other three—twice by being overly choosy (1-2-3, 1-3-2) and once by not being choosy enough (3-2-1).
*实际上略低于37%。准确地说,数学上最佳的申请者比例是1/ e——与复利计算中出现的数学常数e相同,相当于2.71828……。但你不必担心e精确到小数点后12位:35%到40%之间的任何值都足以提供非常接近最大值的成功率。更多数学细节,请参阅本书末尾的注释。
*Just a hair under 37%, actually. To be precise, the mathematically optimal proportion of applicants to look at is 1/e—the same mathematical constant e, equivalent to 2.71828…, that shows up in calculations of compound interest. But you don’t need to worry about knowing e to twelve decimal places: anything between 35% and 40% provides a success rate extremely close to the maximum. For more of the mathematical details, see the notes at the end of the book.
*第 11 章将详细介绍博弈论的计算风险。
*More on the computational perils of game theory in chapter 11.
你的肚子咕咕叫。你是去你熟悉又爱吃的那家意大利餐厅,还是去新开的泰国餐厅?你是带上你最好的朋友,还是联系你想深入了解的新朋友?这太难了——也许你还是待在家里吧。你是做一个你知道会成功的菜谱,还是在网上搜索新的灵感?算了,干脆点个披萨怎么样?你是点你常点的菜,还是问问有什么特色菜?还没吃第一口,你就已经筋疲力尽了。而想到要放唱片、看电影还是读书——选哪个呢? ——似乎都不再那么轻松了。
Your stomach rumbles. Do you go to the Italian restaurant that you know and love, or the new Thai place that just opened up? Do you take your best friend, or reach out to a new acquaintance you’d like to get to know better? This is too hard—maybe you’ll just stay home. Do you cook a recipe that you know is going to work, or scour the Internet for new inspiration? Never mind, how about you just order a pizza? Do you get your “usual,” or ask about the specials? You’re already exhausted before you get to the first bite. And the thought of putting on a record, watching a movie, or reading a book—which one?—no longer seems quite so relaxing.
每天,我们都被迫在诸多选项之间做出抉择,而这些选项在某个特定维度上存在着巨大的差异:是尝试新事物,还是坚持自己喜欢的?我们本能地明白,生活就是在新奇与传统、最新与最棒、冒险与享受我们熟悉和热爱的事物之间寻求平衡。但就像找房时“看一看还是跳一跳”的困境一样,悬而未决的问题是:该如何平衡?
Every day we are constantly forced to make decisions between options that differ in a very specific dimension: do we try new things or stick with our favorite ones? We intuitively understand that life is a balance between novelty and tradition, between the latest and the greatest, between taking risks and savoring what we know and love. But just as with the look-or-leap dilemma of the apartment hunt, the unanswered question is: what balance?
在 1974 年出版的经典著作《禅与摩托车维修艺术》中,罗伯特·波西格 (Robert Pirsig) 批判了以“什么是新的?”作为开场白的对话,他认为这个问题“如果只追寻,结果只会是无休止的琐事和时尚的游行,以及明天的淤泥”。他赞同另一种更为优越的答案:“什么是最好的?”
In the 1974 classic Zen and the Art of Motorcycle Maintenance, Robert Pirsig decries the conversational opener “What’s new?”—arguing that the question, “if pursued exclusively, results only in an endless parade of trivia and fashion, the silt of tomorrow.” He endorses an alternative as vastly superior: “What’s best?”
但现实并非如此简单。记住,你最爱的每一首“最佳”歌曲和每一家餐厅,最初对你来说都只是“新鲜”的事物,这提醒我们,或许还有未知的最佳事物存在——因此,这些新事物确实值得我们至少关注一下。
But the reality is not so simple. Remembering that every “best” song and restaurant among your favorites began humbly as something merely “new” to you is a reminder that there may be yet-unknown bests still out there—and thus that the new is indeed worthy of at least some of our attention.
一些陈旧的格言承认了这种矛盾,却未能解决它。“结交新朋友,但要保留旧友/那些是银,那些是金”以及“人生没有比这更丰富珍贵的/但多一个朋友就能拥有它”这些格言的确名副其实;它们的韵律当然无可指摘。但它们未能告诉我们任何有用的信息,例如,“银”和“金”的比例,才能构成美好人生的最佳合金。
Age-worn aphorisms acknowledge this tension but don’t solve it. “Make new friends, but keep the old / Those are silver, these are gold,” and “There is no life so rich and rare / But one more friend could enter there” are true enough; certainly their scansion is unimpeachable. But they fail to tell us anything useful about the ratio of, say, “silver” and “gold” that makes the best alloy of a life well lived.
五十多年来,计算机科学家们一直致力于寻找这种平衡。他们甚至为此起了个名字:探索/利用权衡。
Computer scientists have been working on finding this balance for more than fifty years. They even have a name for it: the explore/exploit tradeoff.
探索/利用
Explore/Exploit
在英语中,“探索”和“利用”这两个词的含义截然相反。但对于计算机科学家来说,这两个词的含义要具体得多,也更中性。简而言之,探索是收集信息,而利用是利用你掌握的信息来获得已知的良好结果。
In English, the words “explore” and “exploit” come loaded with completely opposite connotations. But to a computer scientist, these words have much more specific and neutral meanings. Simply put, exploration is gathering information, and exploitation is using the information you have to get a known good result.
直觉告诉我们,不探索就无法生存。但同样值得一提的是,不去利用也同样糟糕。在计算机科学的定义中,利用实际上描述了我们生活中许多美好的时刻。节假日全家团聚也是一种利用。书虫坐在阅读椅上,手捧一杯热咖啡,读一本心爱的书,乐队为一群狂热的歌迷演奏他们的金曲,一对经受住时间考验的情侣随着“他们的歌”翩翩起舞,也是一种利用。
It’s fairly intuitive that never exploring is no way to live. But it’s also worth mentioning that never exploiting can be every bit as bad. In the computer science definition, exploitation actually comes to characterize many of what we consider to be life’s best moments. A family gathering together on the holidays is exploitation. So is a bookworm settling into a reading chair with a hot cup of coffee and a beloved favorite, or a band playing their greatest hits to a crowd of adoring fans, or a couple that has stood the test of time dancing to “their song.”
更重要的是,探索也可能是一种诅咒。
What’s more, exploration can be a curse.
比如,音乐的美妙之处在于总有新的东西可以听。或者,如果你是一名音乐记者,音乐的糟糕之处在于总有新的东西可以听。成为一名音乐记者意味着将探索旋钮一直调到 11,一直都是新事物。音乐爱好者可能会想象从事音乐新闻工作是天堂,但是当你必须不断探索新事物时,你永远无法享受鉴赏的成果——这是一种特殊的地狱。很少有人像Pitchfork前主编 Scott Plagenhoef 那样深刻地体会这种经历。他在谈到评论家的生活时说:“当你工作时,你会试图寻找空间来听一些你只想听的东西。”他迫切地渴望停止沉迷于那些质量可疑的、从未听过的曲子,只听自己喜欢的音乐。这种渴望如此强烈,以至于普拉根霍夫只在iPod里放新歌,让自己在真正想听史密斯乐队的时候无法放弃工作。记者是殉道者,他们探索是为了被他人利用。
Part of what’s nice about music, for instance, is that there are constantly new things to listen to. Or, if you’re a music journalist, part of what’s terrible about music is that there are constantly new things to listen to. Being a music journalist means turning the exploration dial all the way to 11, where it’s nothing but new things all the time. Music lovers might imagine working in music journalism to be paradise, but when you constantly have to explore the new you can never enjoy the fruits of your connoisseurship—a particular kind of hell. Few people know this experience as deeply as Scott Plagenhoef, the former editor in chief of Pitchfork. “You try to find spaces when you’re working to listen to something that you just want to listen to,” he says of a critic’s life. His desperate urges to stop wading through unheard tunes of dubious quality and just listen to what he loved were so strong that Plagenhoef would put only new music on his iPod, to make himself physically incapable of abandoning his duties in those moments when he just really, really, really wanted to listen to the Smiths. Journalists are martyrs, exploring so that others may exploit.
在计算机科学中,探索与利用之间的矛盾在一个被称为“多臂老虎机问题”的场景中体现得最为具体。这个奇怪的名字来源于赌场老虎机的俗语“单臂老虎机”。想象一下,走进一个摆满各种老虎机的赌场,每台老虎机都有各自的赔率。当然,问题在于你事先并不知道这些赔率:在你开始玩之前,你根本不知道哪些机器最赚钱(老虎机爱好者称之为“松散型”),哪些机器只是赔钱的陷阱。
In computer science, the tension between exploration and exploitation takes its most concrete form in a scenario called the “multi-armed bandit problem.” The odd name comes from the colloquial term for a casino slot machine, the “one-armed bandit.” Imagine walking into a casino full of different slot machines, each one with its own odds of a payoff. The rub, of course, is that you aren’t told those odds in advance: until you start playing, you won’t have any idea which machines are the most lucrative (“loose,” as slot-machine aficionados call it) and which ones are just money sinks.
当然,你希望最大化你的总赢利。显然,这需要你结合多种策略,比如拉动不同机器的摇杆进行测试(探索),以及选择你发现的最有潜力的机器(利用)。
Naturally, you’re interested in maximizing your total winnings. And it’s clear that this is going to involve some combination of pulling the arms on different machines to test them out (exploring), and favoring the most promising machines you’ve found (exploiting).
为了理解这个问题的微妙之处,想象一下你只面对两台机器。一台你总共玩了15次;其中9次赢钱,6次没赢。另一台你只玩了两次,一次赢钱,一次没赢钱。哪台机器更有希望赢钱?
To get a sense for the problem’s subtleties, imagine being faced with only two machines. One you’ve played a total of 15 times; 9 times it paid out, and 6 times it didn’t. The other you’ve played only twice, and it once paid out and once did not. Which is more promising?
只需将中奖次数除以总抽奖次数,就能得出机器的“预期值”,按照这种方法,第一台机器明显胜出。它的9-6记录使其预期值达到60%,而第二台机器的1-1记录使其预期值仅为50%。但事情远不止于此。毕竟,两次抽奖的次数其实并不多。所以,从某种意义上说,我们还不知道第二台机器的实际表现究竟如何。
Simply dividing the wins by the total number of pulls will give you the machine’s “expected value,” and by this method the first machine clearly comes out ahead. Its 9–6 record makes for an expected value of 60%, whereas the second machine’s 1–1 record yields an expected value of only 50%. But there’s more to it than that. After all, just two pulls aren’t really very many. So there’s a sense in which we just don’t yet know how good the second machine might actually be.
选择一家餐厅或一张专辑,实际上就像在人生的赌场里决定拉哪只手一样。但理解探索与利用之间的权衡,不仅仅是为了更好地决定去哪里吃饭或听什么音乐。它还能提供一些根本性的洞见,让我们了解随着年龄增长,我们的目标应该如何变化,以及为什么最理性的行动并不总是试图选择最好的。事实证明,这恰恰是网页设计和临床试验等诸多领域的核心——这两个话题通常不会在同一句话中被提及。
Choosing a restaurant or an album is, in effect, a matter of deciding which arm to pull in life’s casino. But understanding the explore/exploit tradeoff isn’t just a way to improve decisions about where to eat or what to listen to. It also provides fundamental insights into how our goals should change as we age, and why the most rational course of action isn’t always trying to choose the best. And it turns out to be at the heart of, among other things, web design and clinical trials—two topics that normally aren’t mentioned in the same sentence.
人们倾向于孤立地看待决策,每次都专注于寻找预期价值最高的结果。但决策几乎从来都不是孤立的,预期价值也并非故事的终点。如果你不仅考虑下一个决策,还考虑未来针对相同选项做出的所有决策,那么探索/利用的权衡对整个过程至关重要。数学家彼得·惠特尔写道,强盗问题“以本质形式体现了所有人类行为中都存在的冲突”。
People tend to treat decisions in isolation, to focus on finding each time the outcome with the highest expected value. But decisions are almost never isolated, and expected value isn’t the end of the story. If you’re thinking not just about the next decision, but about all the decisions you are going to make about the same options in the future, the explore/exploit tradeoff is crucial to the process. In this way, writes mathematician Peter Whittle, the bandit problem “embodies in essential form a conflict evident in all human action.”
那么,你应该选择哪一只手呢?这是一个棘手的问题。这完全取决于我们还没讨论过的一个问题:你计划在赌场待多久。
So which of those two arms should you pull? It’s a trick question. It completely depends on something we haven’t discussed yet: how long you plan to be in the casino.
抓住间隙
Seize the Interval
“及时行乐”,这是罗宾·威廉姆斯在1989年的电影《死亡诗社》中最令人难忘的一幕中敦促道。“抓住今天,孩子们。让你们的人生变得非凡。”
“Carpe diem,” urges Robin Williams in one of the most memorable scenes of the 1989 film Dead Poets Society. “Seize the day, boys. Make your lives extraordinary.”
这是非常重要的建议,但也有些自相矛盾。抓住每一天和抓住一生是两种截然不同的追求。我们有句俗语:“吃吃喝喝,尽情享受吧,因为明天我们就要死了。” 但或许我们也应该反过来说:“开始学习一门新语言或乐器,和陌生人闲聊,因为人生漫长,谁知道岁月流逝后,会绽放出怎样的喜悦呢?” 在平衡喜爱的经历和新体验时,没有什么比我们计划享受它们的时间间隔更重要了。
It’s incredibly important advice. It’s also somewhat self-contradictory. Seizing a day and seizing a lifetime are two entirely different endeavors. We have the expression “Eat, drink, and be merry, for tomorrow we die,” but perhaps we should also have its inverse: “Start learning a new language or an instrument, and make small talk with a stranger, because life is long, and who knows what joy could blossom over many years’ time.” When balancing favorite experiences and new ones, nothing matters as much as the interval over which we plan to enjoy them.
“我搬到一个城市时比离开时更有可能尝试新餐厅,”数据科学家兼博主克里斯·斯图基奥(Chris Stucchio)解释道,他是一位在工作和生活中不断权衡探索与利用之间关系的老手。“我现在主要去我熟悉和喜欢的餐厅,因为我知道我很快就要离开纽约了。几年前我搬到印度浦那,我会去所有看起来不会让我饿死的地方吃。而当我离开这座城市时,我又回到了所有我以前喜欢的餐厅,而不是尝试新的东西……即使我找到一个稍微好一点的地方,我也只会去一两次,所以为什么要冒这个险呢?”
“I’m more likely to try a new restaurant when I move to a city than when I’m leaving it,” explains data scientist and blogger Chris Stucchio, a veteran of grappling with the explore/exploit tradeoff in both his work and his life. “I mostly go to restaurants I know and love now, because I know I’m going to be leaving New York fairly soon. Whereas a couple years ago I moved to Pune, India, and I just would eat friggin’ everywhere that didn’t look like it was gonna kill me. And as I was leaving the city I went back to all my old favorites, rather than trying out new stuff.… Even if I find a slightly better place, I’m only going to go there once or twice, so why take the risk?”
尝试新事物的一个令人警醒的特性是,探索的价值,找到新的心头好的价值,只会随着时间的推移而逐渐降低,因为剩下的品味机会越来越少。在城里的最后一晚发现一家迷人的咖啡馆,并不意味着你有机会再去。
A sobering property of trying new things is that the value of exploration, of finding a new favorite, can only go down over time, as the remaining opportunities to savor it dwindle. Discovering an enchanting café on your last night in town doesn’t give you the opportunity to return.
另一方面,利用的价值只会随着时间的推移而增长。你今天知道的最可爱的咖啡馆,顾名思义,至少和你上个月知道的最可爱的咖啡馆一样可爱。(如果你后来找到了另一家心仪的咖啡馆,那可能还会更可爱。)所以,探索你何时有时间运用这些知识,并在你准备好兑现时进行利用。间隔决定策略。
The flip side is that the value of exploitation can only go up over time. The loveliest café that you know about today is, by definition, at least as lovely as the loveliest café you knew about last month. (And if you’ve found another favorite since then, it might just be more so.) So explore when you will have time to use the resulting knowledge, exploit when you’re ready to cash in. The interval makes the strategy.
有趣的是,既然间隔决定了策略,那么通过观察策略,我们也可以推断出间隔。以好莱坞为例:1981年票房最高的十部电影中,只有两部是续集。1991年有三部,2001年有五部。而2011年,票房最高的十部电影中有八部是续集。事实上,2011年创下了各大电影公司发行的续集比例最高的纪录。然后2012年立即打破了这一纪录;第二年又将再次打破。2012年12月,记者尼克·艾伦对来年展望时,明显感到疲惫不堪:
Interestingly, since the interval makes the strategy, then by observing the strategy we can also infer the interval. Take Hollywood, for instance: Among the ten highest-grossing movies of 1981, only two were sequels. In 1991, it was three. In 2001, it was five. And in 2011, eight of the top ten highest-grossing films were sequels. In fact, 2011 set a record for the greatest percentage of sequels among major studio releases. Then 2012 immediately broke that record; the next year would break it again. In December 2012, journalist Nick Allen looked ahead with palpable fatigue to the year to come:
观众将有机会欣赏到《X战警》第六部、《速度与激情6》、《虎胆龙威5》、《惊声尖笑5》和《鬼影实录5》等多部影片。此外,还将有《钢铁侠3》、《宿醉3》以及《布偶大电影》 、《蓝精灵》、《特种部队》和《圣诞坏公公》的续集。
Audiences will be given a sixth helping of X-Men plus Fast and Furious 6, Die Hard 5, Scary Movie 5 and Paranormal Activity 5. There will also be Iron Man 3, The Hangover 3, and second outings for The Muppets, The Smurfs, GI Joe and Bad Santa.
从电影公司的角度来看,续集是一部拥有稳定粉丝群的电影:摇钱树、稳赚不赔、功不可没。而过多的稳赚不赔的续集则表明了一种短视的做法,就像即将离开的斯图奇奥一样。今年,续集比全新电影更有可能成为热门,但未来那些备受喜爱的系列电影又将从何而来?如此泛滥的续集不仅令人惋惜(影评人当然这么认为),也颇具讽刺意味。电影业进入了一个几乎纯粹以功不可没的阶段,似乎在暗示它已经接近尾声。
From a studio’s perspective, a sequel is a movie with a guaranteed fan base: a cash cow, a sure thing, an exploit. And an overload of sure things signals a short-termist approach, as with Stucchio on his way out of town. The sequels are more likely than brand-new movies to be hits this year, but where will the beloved franchises of the future come from? Such a sequel deluge is not only lamentable (certainly critics think so); it’s also somewhat poignant. By entering an almost purely exploit-focused phase, the film industry seems to be signaling a belief that it is near the end of its interval.
看看好莱坞的经济状况,就能证实这一猜测。2007年至2011年间,大型电影制片厂的利润下降了40%,过去十年中有七年票房收入都在下降。正如《经济学人》所言:“在成本上升和收入下降的双重夹击下,大型电影制片厂的应对之策是努力制作更多他们认为会大卖的电影:通常是续集、前传,或者任何以知名角色为主角的电影。” 换句话说,他们正在抢在赌场把最好的机器都抢走之前,把机器的机械臂都拉起来。
A look into the economics of Hollywood confirms this hunch. Profits of the largest film studios declined by 40% between 2007 and 2011, and ticket sales have declined in seven of the past ten years. As the Economist puts it, “Squeezed between rising costs and falling revenues, the big studios have responded by trying to make more films they think will be hits: usually sequels, prequels, or anything featuring characters with name recognition.” In other words, they’re pulling the arms of the best machines they’ve got before the casino turns them out.
赢留
Win-Stay
事实证明,找到能够精确解决多臂老虎机问题的最佳算法极具挑战性。正如彼得·惠特尔 (Peter Whittle) 所述,二战期间,解决这个问题的努力“耗费了盟军分析人员的精力和心智……以至于有人建议将这个问题扔到德国,作为破坏智力的终极工具。”
Finding optimal algorithms that tell us exactly how to handle the multi-armed bandit problem has proven incredibly challenging. Indeed, as Peter Whittle recounts, during World War II efforts to solve the question “so sapped the energies and minds of Allied analysts … that the suggestion was made that the problem be dropped over Germany, as the ultimate instrument of intellectual sabotage.”
战后几年,哥伦比亚大学数学家赫伯特·罗宾斯 (Herbert Robbins) 向人们展示了一种简单的策略,虽然并不完美,但却能带来一些不错的保证,因此迈出了解决问题的第一步。
The first steps toward a solution were taken in the years after the war, when Columbia mathematician Herbert Robbins showed that there’s a simple strategy that, while not perfect, comes with some nice guarantees.
罗宾斯特别考虑了只有两台老虎机的情况,并提出了一种名为“赢-留,输-换”算法的解决方案:随机选择一只摇臂,只要它能持续盈利,就一直摇。如果摇臂在某次摇动后没有盈利,则切换到另一只。虽然这个简单的策略远非完美解决方案,但罗宾斯在1952年证明了,它的表现确实比随机决策更好。
Robbins specifically considered the case where there are exactly two slot machines, and proposed a solution called the Win-Stay, Lose-Shift algorithm: choose an arm at random, and keep pulling it as long as it keeps paying off. If the arm doesn’t pay off after a particular pull, then switch to the other one. Although this simple strategy is far from a complete solution, Robbins proved in 1952 that it performs reliably better than chance.
继罗宾斯之后,一系列论文进一步探讨了“坚持赢家”原则。直观地说,如果你已经愿意拉一只手臂,而且它刚刚获得了回报,这只会增加你对其价值的估计,你也应该更愿意再次拉它。事实上,“赢家-坚持”原则在各种条件下,都是平衡探索与利用的最优策略的一个要素。
Following Robbins, a series of papers examined the “stay on a winner” principle further. Intuitively, if you were already willing to pull an arm, and it has just paid off, that should only increase your estimate of its value, and you should be only more willing to pull it again. And indeed, win-stay turns out to be an element of the optimal strategy for balancing exploration and exploitation under a wide range of conditions.
但“失手”又是另一回事。每次失败就换个手臂,这实在是太轻率了。想象一下,你去同一家餐厅一百次,每次都吃到美味佳肴。一次失望就足以让你放弃吗?好的选择不应该因为不完美而受到过分的惩罚。
But lose-shift is another story. Changing arms each time one fails is a pretty rash move. Imagine going to a restaurant a hundred times, each time having a wonderful meal. Would one disappointment be enough to induce you to give up on it? Good options shouldn’t be penalized too strongly for being imperfect.
更重要的是,“赢-留,输-换”算法对你优化的时间间隔没有任何概念。如果你上次最喜欢的餐厅让你失望了,那么算法总是建议你去另一家——即使这是你在城里的最后一晚。
More significantly, Win-Stay, Lose-Shift doesn’t have any notion of the interval over which you are optimizing. If your favorite restaurant disappointed you the last time you ate there, that algorithm always says you should go to another place—even if it’s your last night in town.
尽管如此,罗宾斯在多臂老虎机问题上的初步研究开启了大量文献,研究人员在接下来的几年里取得了重大进展。兰德公司的数学家理查德·贝尔曼找到了这个问题的精确解,适用于我们事先知道总共有多少个选项和机会的情况。与完全信息秘书问题一样,贝尔曼的技巧本质上是逆向思考,首先想象最后一次抽奖,并考虑在之前所有可能结果的情况下选择哪台老虎机。弄清楚之后,你会转向倒数第二个机会,然后是前一个机会,再前一个机会,一直回到起点。
Still, Robbins’s initial work on the multi-armed bandit problem kicked off a substantial literature, and researchers made significant progress over the next few years. Richard Bellman, a mathematician at the RAND Corporation, found an exact solution to the problem for cases where we know in advance exactly how many options and opportunities we’ll have in total. As with the full-information secretary problem, Bellman’s trick was essentially to work backward, starting by imagining the final pull and considering which slot machine to choose given all the possible outcomes of the previous decisions. Having figured that out, you’d then turn to the second-to-last opportunity, then the previous one, and the one before that, all the way back to the start.
贝尔曼方法得出的答案固然可靠,但由于选择众多,而且赌场之旅漫长,这可能需要耗费大量精力,甚至不可能完成。更重要的是,即使我们能够计算所有可能的未来,我们也并不总是确切知道我们究竟有多少机会(甚至有多少选择)。由于这些原因,多臂老虎机问题实际上一直悬而未决。用惠特尔的话来说,“它很快就成了经典,成了顽固不化的代名词。”
The answers that emerge from Bellman’s method are ironclad, but with many options and a long casino visit it can require a dizzying—or impossible—amount of work. What’s more, even if we are able to calculate all possible futures, we of course don’t always know exactly how many opportunities (or even how many options) we’ll have. For these reasons, the multi-armed bandit problem effectively stayed unsolved. In Whittle’s words, “it quickly became a classic, and a byword for intransigence.”
吉廷斯指数
The Gittins Index
然而,正如数学中经常发生的那样,特殊性是通往普遍性的大门。20世纪70年代,联合利华公司邀请一位名叫约翰·吉廷斯的年轻数学家帮助他们优化一些药物试验。出乎意料的是,他们得到的竟然是一个困扰了一代人的数学谜题的答案。
As so often happens in mathematics, though, the particular is the gateway to the universal. In the 1970s, the Unilever corporation asked a young mathematician named John Gittins to help them optimize some of their drug trials. Unexpectedly, what they got was the answer to a mathematical riddle that had gone unsolved for a generation.
吉廷斯如今是牛津大学的统计学教授,他思考了联合利华提出的问题。给定几种不同的化合物,如何最快地确定哪种化合物可能对某种疾病有效?吉廷斯试图将这个问题尽可能概括为:多个选项,每个选项有不同的奖励概率,以及在这些选项之间分配一定量的精力(或金钱或时间)。当然,这又是多臂老虎机问题的另一种体现。
Gittins, who is now a professor of statistics at Oxford, pondered the question posed by Unilever. Given several different chemical compounds, what is the quickest way to determine which compound is likely to be effective against a disease? Gittins tried to cast the problem in the most general form he could: multiple options to pursue, a different probability of reward for each option, and a certain amount of effort (or money, or time) to be allocated among them. It was, of course, another incarnation of the multi-armed bandit problem.
营利性制药公司及其服务的医疗行业始终面临着探索与利用之间权衡的竞争需求。制药公司希望将研发资金投入到新药研发中,同时也希望确保其现有盈利产品线能够蓬勃发展。医生希望开出现有的最佳疗法,以便患者获得所需的治疗,同时也希望鼓励可能发现更佳疗法的实验研究。
Both the for-profit drug companies and the medical profession they serve are constantly faced with the competing demands of the explore/exploit tradeoff. Companies want to invest R & D money into the discovery of new drugs, but also want to make sure their profitable current product lines are flourishing. Doctors want to prescribe the best existing treatments so that patients get the care they need, but also want to encourage experimental studies that may turn up even better ones.
值得注意的是,在这两种情况下,相关的时间间隔应该是多少并不完全明确。从某种意义上说,制药公司和医生都对不确定的未来感兴趣。公司希望理论上永远存在,而在医学方面,一项突破可能会持续帮助那些尚未出生的人。尽管如此,现在仍然具有更高的优先级:今天治愈的患者被认为比一周或一年后治愈的患者更有价值,利润当然也是如此。经济学家将这种重视现在而非未来的观念称为“贴现”。
In both cases, notably, it’s not entirely clear what the relevant interval ought to be. In a sense, drug companies and doctors alike are interested in the indefinite future. Companies want to be around theoretically forever, and on the medical side a breakthrough could go on to help people who haven’t even been born yet. Nonetheless, the present has a higher priority: a cured patient today is taken to be more valuable than one cured a week or a year from now, and certainly the same holds true of profits. Economists refer to this idea, of valuing the present more highly than the future, as “discounting.”
与之前的研究人员不同,吉廷斯用这些术语来研究多臂老虎机问题。他认为,目标不是最大化固定时间间隔内的收益,而是最大化无限但折扣的未来收益。
Unlike previous researchers, Gittins approached the multi-armed bandit problem in those terms. He conceived the goal as maximizing payoffs not for a fixed interval of time, but for a future that is endless yet discounted.
这种折扣在我们自己的生活中并不陌生。毕竟,如果你去某个小镇度假十天,那么你应该以固定的时间间隔来决定去哪个餐厅用餐;但如果你住在镇上,这就没那么合理了。相反,你可能会认为,收益的价值会随着时间推移而减少:你更关心今晚要吃的饭菜,而不是明天要吃的饭菜;你更关心明天的饭菜,而不是一年后的饭菜,具体减少多少取决于你特定的“折扣函数”。吉廷斯则假设,赋予收益的价值呈几何级数递减:也就是说,你每次去餐厅用餐的价值都是上一次用餐价值的常数倍。假设你认为在任何一天你被公交车撞到的概率是1%,那么你应该把明天的晚餐的价值定为今晚晚餐价值的99%,因为你可能永远都吃不到它。
Such discounting is not unfamiliar to us from our own lives. After all, if you visit a town for a ten-day vacation, then you should be making your restaurant decisions with a fixed interval in mind; but if you live in the town, this doesn’t make as much sense. Instead, you might imagine the value of payoffs decreasing the further into the future they are: you care more about the meal you’re going to eat tonight than the meal you’re going to eat tomorrow, and more about tomorrow’s meal than one a year from now, with the specifics of how much more depending on your particular “discount function.” Gittins, for his part, made the assumption that the value assigned to payoffs decreases geometrically: that is, each restaurant visit you make is worth a constant fraction of the last one. If, let’s say, you believe there is a 1% chance you’ll get hit by a bus on any given day, then you should value tomorrow’s dinner at 99% of the value of tonight’s, if only because you might never get to eat it.
基于这个几何折现假设,吉廷斯研究了一种他认为“至少相当接近”的策略:将多臂老虎机的每个臂分开考虑,并尝试计算出每个臂的价值。他通过想象一个相当巧妙的方案来做到这一点:贿赂。
Working with this geometric-discounting assumption, Gittins investigated a strategy that he thought “at least would be a pretty good approximation”: to think about each arm of the multi-armed bandit separately from the others, and try to work out the value of that arm on its own. He did this by imagining something rather ingenious: a bribe.
在热门电视游戏节目《一掷千金》(Deal or No Deal)中,参赛者从26个公文包中选择一个,每个公文包里的奖品价值从一美分到一百万美元不等。随着游戏的进行,一位名为“银行家”的神秘人物会定期出现,向参赛者提供不同数额的金钱,让他们不打开所选的公文包。参赛者需要决定,他们愿意付出什么代价,去选择确定无疑的公文包奖品,而不是不确定的公文包奖品。
In the popular television game show Deal or No Deal, a contestant chooses one of twenty-six briefcases, which contain prizes ranging from a penny to a million dollars. As the game progresses, a mysterious character called the Banker will periodically call in and offer the contestant various sums of money to not open the chosen briefcase. It’s up to the contestant to decide at what price they’re willing to take a sure thing over the uncertainty of the briefcase prize.
吉廷斯(尽管早在《一掷千金》( Deal or No Deal )第一集播出前很多年)就意识到,多臂老虎机问题也同样如此。对于每一台我们知之甚少或一无所知的老虎机,都存在着一个保证的赔付率,如果能用这个赔付率来代替那台机器,我们就会心满意足地不再拉它的手柄。这个数字——吉廷斯称之为“动态分配指数”,如今也被世人称为吉廷斯指数——暗示了赌场中一个显而易见的策略:永远玩指数最高的那只手。*
Gittins (albeit many years before the first episode of Deal or No Deal aired) realized that the multi-armed bandit problem is no different. For every slot machine we know little or nothing about, there is some guaranteed payout rate which, if offered to us in lieu of that machine, will make us quite content never to pull its handle again. This number—which Gittins called the “dynamic allocation index,” and which the world now knows as the Gittins index—suggests an obvious strategy on the casino floor: always play the arm with the highest index.*
事实上,指数策略不仅仅是一个好的近似值。它完全解决了收益几何折扣的多臂老虎机问题。探索与利用之间的矛盾最终转化为一个更简单的任务:最大化一个能够同时考虑两者的量。吉廷斯对这一成就很谦虚——“这不完全是费马大定理,”他笑着说——但这个定理解决了一系列关于探索/利用困境的重要问题。
In fact, the index strategy turned out to be more than a good approximation. It completely solves the multi-armed bandit with geometrically discounted payoffs. The tension between exploration and exploitation resolves into the simpler task of maximizing a single quantity that accounts for both. Gittins is modest about the achievement—“It’s not quite Fermat’s Last Theorem,” he says with a chuckle—but it’s a theorem that put to rest a significant set of questions about the explore/exploit dilemma.
现在,考虑到特定机器的历史记录和我们的折现率,实际计算其基廷斯指数仍然相当复杂。但是,一旦知道了特定假设集的基廷斯指数,它就可以用于任何该形式的问题。至关重要的是,涉及多少个分支甚至都无关紧要,因为每个分支的指数都是单独计算的。
Now, actually calculating the Gittins index for a specific machine, given its track record and our discounting rate, is still fairly involved. But once the Gittins index for a particular set of assumptions is known, it can be used for any problem of that form. Crucially, it doesn’t even matter how many arms are involved, since the index for each arm is calculated separately.
在下一页的表格中,我们提供了最多九次成功和失败的吉廷斯指数值,假设下次拉动的收益相当于当前收益的90%。这些值可用于解决各种日常的多臂老虎机问题。例如,在这些假设下,你实际上应该选择记录为1-1(预期值为50%)的老虎机,而不是记录为9-6(预期值为60%)的老虎机。查找表中的相关坐标,你会发现那台不太知名的机器的指数为0.6346,而玩得更多的机器的指数只有0.6300。问题解决了:这次试试你的运气,去探索吧。
In the table on the next page we provide the Gittins index values for up to nine successes and failures, assuming that a payoff on our next pull is worth 90% of a payoff now. These values can be used to resolve a variety of everyday multi-armed bandit problems. For example, under these assumptions you should, in fact, choose the slot machine that has a track record of 1–1 (and an expected value of 50%) over the one with a track record of 9–6 (and an expected value of 60%). Looking up the relevant coordinates in the table shows that the lesser-known machine has an index of 0.6346, while the more-played machine scores only a 0.6300. Problem solved: try your luck this time, and explore.
观察表格中的基廷斯指数值,你会发现一些其他有趣的现象。首先,你可以看到“赢-留”原则在起作用:在任何一行中,当你从左到右移动时,指数分数总是递增。因此,如果某只手臂是正确的,并且这次拉动是成功的,那么(按照右侧图表)再次拉动同一只手臂只会更有意义。其次,你可以看到“输-移”策略会在哪些方面给你带来麻烦。如果你最初赢了九次,然后又输了一次,你的指数就会达到0.8695,这仍然高于表格中的大多数其他值——所以你应该至少再用那只手臂拉一次。
Looking at the Gittins index values in the table, there are a few other interesting observations. First, you can see the win-stay principle at work: as you go from left to right in any row, the index scores always increase. So if an arm is ever the correct one to pull, and that pull is a winner, then (following the chart to the right) it can only make more sense to pull the same arm again. Second, you can see where lose-shift would get you into trouble. Having nine initial wins followed by a loss gets you an index of 0.8695, which is still higher than most of the other values in the table—so you should probably stay with that arm for at least another pull.
吉廷斯指数值是胜负函数,假设下一次的收益是现在收益的 90%。
Gittins index values as a function of wins and losses, assuming that a payoff next time is worth 90% of a payoff now.
但表格中最有趣的部分或许是左上角的条目。0-0 的记录——一个完全未知的机器——的预期值为 0.5000,但基廷斯指数为 0.7029。换句话说,你完全没有经验的东西比你知道十有八九会付钱的机器更有吸引力!沿着对角线往下看,请注意 1-1 的记录产生的指数为 0.6346,2-2 的记录产生的指数为 0.6010,依此类推。如果这种 50% 成功率的表现持续下去,指数最终会收敛于 0.5000,因为经验证实这台机器确实没什么特别之处,并带走了刺激进一步探索的“奖励”。但收敛速度相当缓慢;探索奖励是一股强大的力量。事实上,请注意,即使第一次拉动就失败,产生 0-1 的记录,但 Gittins 指数仍然高于 50%。
But perhaps the most interesting part of the table is the top-left entry. A record of 0–0—an arm that’s a complete unknown—has an expected value of 0.5000 but a Gittins index of 0.7029. In other words, something you have no experience with whatsoever is more attractive than a machine that you know pays out seven times out of ten! As you go down the diagonal, notice that a record of 1–1 yields an index of 0.6346, a record of 2–2 yields 0.6010, and so on. If such 50%-successful performance persists, the index does ultimately converge on 0.5000, as experience confirms that the machine is indeed nothing special and takes away the “bonus” that spurs further exploration. But the convergence happens fairly slowly; the exploration bonus is a powerful force. Indeed, note that even a failure on the very first pull, producing a record of 0–1, makes for a Gittins index that’s still above 50%.
我们还可以看到,随着我们改变对未来进行贴现的方式,探索/利用的权衡是如何变化的。下表呈现的信息与上表完全相同,但假设下次的收益是现在的99%,而不是90%。由于未来的权重几乎与现在一样大,相对于选择稳赚不赔的事情,偶然发现的价值会更高。在这里,一台完全未经测试、记录为0-0的机器,却拥有86.99%的保证赔付概率!
We can also see how the explore/exploit tradeoff changes as we change the way we’re discounting the future. The following table presents exactly the same information as the preceding one, but assumes that a payoff next time is worth 99% of one now, rather than 90%. With the future weighted nearly as heavily as the present, the value of making a chance discovery, relative to taking a sure thing, goes up even more. Here, a totally untested machine with a 0–0 record is worth a guaranteed 86.99% chance of a payout!
吉廷斯指数值是胜负函数,假设下一次的收益相当于现在收益的 99%。
Gittins index values as a function of wins and losses, assuming that a payoff next time is worth 99% of a payoff now.
因此,吉廷斯指数为我们偏好未知领域提供了一个正式而严谨的论证,前提是我们有机会利用探索所得的成果。古语有云:“篱笆那边的草总是更绿”,但数学告诉我们原因:即使我们实际上预期未知领域与预期并无二致,或者它同样可能更糟,它也可能变得更好。未经考验的新秀比看似能力相当的老将更有价值(至少在赛季初期是这样),正是因为我们对他了解较少。探索本身就具有价值,因为尝试新事物会增加我们找到最佳方案的机会。因此,着眼于未来,而不是仅仅关注现在,会驱使我们追求新奇。
The Gittins index, then, provides a formal, rigorous justification for preferring the unknown, provided we have some opportunity to exploit the results of what we learn from exploring. The old adage tells us that “the grass is always greener on the other side of the fence,” but the math tells us why: the unknown has a chance of being better, even if we actually expect it to be no different, or if it’s just as likely to be worse. The untested rookie is worth more (early in the season, anyway) than the veteran of seemingly equal ability, precisely because we know less about him. Exploration in itself has value, since trying new things increases our chances of finding the best. So taking the future into account, rather than focusing just on the present, drives us toward novelty.
因此,基廷斯指数为多臂老虎机问题提供了一个极其直接的解决方案。但它并不一定能彻底解决这个难题,也无法帮助我们应对日常生活中所有探索/利用的权衡。首先,基廷斯指数仅在一些强有力的假设下才是最优的。它基于未来奖励的几何折现,将每次下拉的价值视为前一次下拉的固定分数,而行为经济学和心理学领域的各种实验表明,人们不会这样做。而且,如果在选项之间切换需要成本,那么基廷斯策略也不再是最优的。(篱笆另一边的草可能看起来更绿一些,但这并不一定值得你去翻越篱笆——更不用说再贷一笔款了。)或许更重要的是,基廷斯指数很难即时计算。如果你随身携带一张指数值表,你就可以优化你的用餐选择,但为此付出的时间和精力可能并不值得。 (“等等,我可以解决这个问题。那家餐厅 35 次中有 29 次表现不错,但这家餐厅 16 次中有 13 次表现不错,所以 Gittins 指数是……嘿,大家都去哪儿了?”)
The Gittins index thus provides an amazingly straightforward solution to the multi-armed bandit problem. But it doesn’t necessarily close the book on the puzzle, or help us navigate all the explore/exploit tradeoffs of everyday life. For one, the Gittins index is optimal only under some strong assumptions. It’s based on geometric discounting of future reward, valuing each pull at a constant fraction of the previous one, which is something that a variety of experiments in behavioral economics and psychology suggest people don’t do. And if there’s a cost to switching among options, the Gittins strategy is no longer optimal either. (The grass on the other side of the fence may look a bit greener, but that doesn’t necessarily warrant climbing the fence—let alone taking out a second mortgage.) Perhaps even more importantly, it’s hard to compute the Gittins index on the fly. If you carry around a table of index values you can optimize your dining choices, but the time and effort involved might not be worth it. (“Wait, I can resolve this argument. That restaurant was good 29 times out of 35, but this other one has been good 13 times out of 16, so the Gittins indices are … Hey, where did everybody go?”)
自基廷斯指数发展以来,此类担忧促使计算机科学家和统计学家不断探索更简单、更灵活的策略来应对多臂老虎机游戏。这些策略比计算最优基廷斯指数更容易被人类(和机器)应用于各种情况,同时仍能提供相当好的性能。它们也解决了我们人类在决定冒险时最大的恐惧之一。
In the time since the development of the Gittins index, such concerns have sent computer scientists and statisticians searching for simpler and more flexible strategies for dealing with multi-armed bandits. These strategies are easier for humans (and machines) to apply in a range of situations than crunching the optimal Gittins index, while still providing comparably good performance. They also engage with one of our biggest human fears regarding decisions about which chances to take.
遗憾与乐观
Regret and Optimism
后悔的事,我有过一些。不过话说回来,太少了,不便一一列举。
Regrets, I’ve had a few. But then again, too few to mention.
—弗兰克·辛纳屈
—FRANK SINATRA
就我个人而言,我是个乐观主义者。做其他事似乎没什么用。
For myself I am an optimist. It does not seem to be much use being anything else.
—温斯顿·丘吉尔
—WINSTON CHURCHILL
如果基廷斯指数过于复杂,或者你所处的情境并非几何折现的典型特征,那么你还有另一个选择:关注遗憾。当我们选择吃什么、和谁一起度过时光或住在哪个城市时,遗憾便会油然而生——面对一系列不错的选择,我们很容易用错误选择的后果来折磨自己。这些遗憾通常与我们未能做到的事情、从未尝试过的选择有关。正如管理理论家切斯特·巴纳德那句令人难忘的话:“尝试并失败至少是一种学习;不去尝试则会遭受原本可能拥有的无法估量的损失。”
If the Gittins index is too complicated, or if you’re not in a situation well characterized by geometric discounting, then you have another option: focus on regret. When we choose what to eat, who to spend time with, or what city to live in, regret looms large—presented with a set of good options, it is easy to torture ourselves with the consequences of making the wrong choice. These regrets are often about the things we failed to do, the options we never tried. In the memorable words of management theorist Chester Barnard, “To try and fail is at least to learn; to fail to try is to suffer the inestimable loss of what might have been.”
后悔也能带来巨大的激励。在决定创办亚马逊之前,杰夫·贝佐斯在纽约投资公司DE Shaw & Co.拥有一份稳定且高薪的职位。在西雅图开设一家网上书店对他来说将是一次巨大的飞跃——他的老板(也就是DE Shaw)建议他慎重考虑。贝佐斯说道:
Regret can also be highly motivating. Before he decided to start Amazon.com, Jeff Bezos had a secure and well-paid position at the investment company D. E. Shaw & Co. in New York. Starting an online bookstore in Seattle was going to be a big leap—something that his boss (that’s D. E. Shaw) advised him to think about carefully. Says Bezos:
我找到的框架让我能够轻松做出决定,我称之为——只有书呆子才会这么叫——“遗憾最小化框架”。所以我想把自己规划到80岁,然后说:“好吧,现在我回顾我的一生。我希望尽量减少我的遗憾。”我知道,当我80岁的时候,我不会后悔尝试过这些。我不会后悔尝试参与互联网这个我以为会成为大事的东西。我知道如果我失败了,我也不会后悔,但我知道我可能会后悔的一件事就是从未尝试过。我知道那将每天困扰着我,所以,当我这样想的时候,这个决定变得异常轻松。
The framework I found, which made the decision incredibly easy, was what I called—which only a nerd would call—a “regret minimization framework.” So I wanted to project myself forward to age 80 and say, “Okay, now I’m looking back on my life. I want to have minimized the number of regrets I have.” I knew that when I was 80 I was not going to regret having tried this. I was not going to regret trying to participate in this thing called the Internet that I thought was going to be a really big deal. I knew that if I failed I wouldn’t regret that, but I knew the one thing I might regret is not ever having tried. I knew that that would haunt me every day, and so, when I thought about it that way it was an incredibly easy decision.
计算机科学无法让你拥有无悔的人生。但它或许能让你拥有贝佐斯所追寻的东西:无悔的人生。
Computer science can’t offer you a life with no regret. But it can, potentially, offer you just what Bezos was looking for: a life with minimal regret.
后悔是将我们实际所做的与事后看来最好的做法进行比较的结果。在多臂老虎机游戏中,巴纳德的“不可估量的损失”实际上可以精确衡量,并且后悔被赋予了一个数字:它是遵循特定策略获得的总收益与理论上每次只拉最佳臂就能获得的总收益之间的差值(如果我们从一开始就知道是哪一臂的话)。我们可以计算不同策略的这个数字,并寻找那些能够最小化这个数字的策略。
Regret is the result of comparing what we actually did with what would have been best in hindsight. In a multi-armed bandit, Barnard’s “inestimable loss” can in fact be measured precisely, and regret assigned a number: it’s the difference between the total payoff obtained by following a particular strategy and the total payoff that theoretically could have been obtained by just pulling the best arm every single time (had we only known from the start which one it was). We can calculate this number for different strategies, and search for those that minimize it.
1985年,赫伯特·罗宾斯(Herbert Robbins)再次尝试解决多臂老虎机问题,这距离他首次研究“赢-留,输-换”问题已有三十年。他和哥伦比亚大学数学家黎子良(Tze Leung Lai)证明了关于后悔的几个关键点。首先,假设你并非无所不知,即使你选择了最佳策略,你的后悔总量也可能永远不会停止增长——因为即使是最佳策略也并非每次都完美无缺。其次,选择最佳策略时,后悔的增长速度会比选择其他策略时慢;更重要的是,采用好的策略后,后悔的增长率会随着时间的推移而下降,因为你对问题了解得越多,就越能够做出更好的选择。第三,也是最具体地说,最小可能的后悔——同样假设你并非无所不知——是后悔随着每次拉动手柄而以对数速率增长。
In 1985, Herbert Robbins took a second shot at the multi-armed bandit problem, some thirty years after his initial work on Win-Stay, Lose-Shift. He and fellow Columbia mathematician Tze Leung Lai were able to prove several key points about regret. First, assuming you’re not omniscient, your total amount of regret will probably never stop increasing, even if you pick the best possible strategy—because even the best strategy isn’t perfect every time. Second, regret will increase at a slower rate if you pick the best strategy than if you pick others; what’s more, with a good strategy regret’s rate of growth will go down over time, as you learn more about the problem and are able to make better choices. Third, and most specifically, the minimum possible regret—again assuming non-omniscience—is regret that increases at a logarithmic rate with every pull of the handle.
遗憾呈对数增长意味着,我们在前十次尝试中犯的错误与接下来九十次一样多,而我们第一年犯的错误与这十年剩余时间犯的错误总和一样多。(反过来,第一个十年犯的错误与这一个世纪剩余时间犯的错误总和一样多。)这多少让人感到些许安慰。一般来说,我们不可能指望有一天不再后悔。但如果我们遵循一个遗憾最小化算法,那么我们可以预期每年新的遗憾都会比前一年少。
Logarithmically increasing regret means that we’ll make as many mistakes in our first ten pulls as in the following ninety, and as many in our first year as in the rest of the decade combined. (The first decade’s mistakes, in turn, are as many as we’ll make for the rest of the century.) That’s some measure of consolation. In general we can’t realistically expect someday to never have any more regrets. But if we’re following a regret-minimizing algorithm, every year we can expect to have fewer new regrets than we did the year before.
从莱和罗宾斯开始,近几十年来,研究人员一直在寻找能够保证最小遗憾的算法。在他们发现的算法中,最受欢迎的是所谓的“上限置信区间”算法。
Starting with Lai and Robbins, researchers in recent decades have set about looking for algorithms that offer the guarantee of minimal regret. Of the ones they’ve discovered, the most popular are known as Upper Confidence Bound algorithms.
统计数据的可视化展示通常包括所谓的误差线,它延伸到任何数据点的上方和下方,表示测量中的不确定性;误差线显示了被测量量实际可能具有的合理值范围。这个范围被称为“置信区间”,随着我们获得更多关于某事物的数据,置信区间会缩小,反映出评估的准确性。(例如,两次拉动中支付一次的老虎机与十次拉动中支付五次的老虎机相比,其置信区间会更宽,尽管预期值相同。)在多臂老虎机问题中,上限置信边界算法很简单,就是选择置信区间顶部最高的选项。
Visual displays of statistics often include so-called error bars that extend above and below any data point, indicating uncertainty in the measurement; the error bars show the range of plausible values that the quantity being measured could actually have. This range is known as the “confidence interval,” and as we gain more data about something the confidence interval will shrink, reflecting an increasingly accurate assessment. (For instance, a slot machine that has paid out once out of two pulls will have a wider confidence interval, though the same expected value, as a machine that has paid out five times on ten pulls.) In a multi-armed bandit problem, an Upper Confidence Bound algorithm says, quite simply, to pick the option for which the top of the confidence interval is highest.
因此,与基廷斯指数一样,置信上限算法会为多臂老虎机的每个臂分配一个数字。并且,根据目前可用的信息,将该数字设置为该臂可能具有的合理最高值。因此,置信上限算法并不关心哪个臂目前表现最佳;相反,它会选择未来可能表现最佳的臂。例如,如果你以前从未去过一家餐馆,那么你就知道这家餐馆可能很棒。即使你去过一两次,尝试过几道菜,你也可能没有足够的信息来排除这家餐馆可能比你常吃的菜更好的可能性。与基廷斯指数一样,置信上限总是大于预期值,但随着我们对某个特定选项的经验积累,差距会越来越小。 (一家只有一条平庸评论的餐厅仍然具有成为优秀餐厅的潜力,而一家拥有数百条此类评论的餐厅则不具备这种潜力。)上限置信区间算法给出的建议与 Gittins 指数提供的建议类似,但它们的计算要容易得多,并且不需要几何折扣的假设。
Like the Gittins index, therefore, Upper Confidence Bound algorithms assign a single number to each arm of the multi-armed bandit. And that number is set to the highest value that the arm could reasonably have, based on the information available so far. So an Upper Confidence Bound algorithm doesn’t care which arm has performed best so far; instead, it chooses the arm that could reasonably perform best in the future. If you have never been to a restaurant before, for example, then for all you know it could be great. Even if you have gone there once or twice, and tried a couple of their dishes, you might not have enough information to rule out the possibility that it could yet prove better than your regular favorite. Like the Gittins index, the Upper Confidence Bound is always greater than the expected value, but by less and less as we gain more experience with a particular option. (A restaurant with a single mediocre review still retains a potential for greatness that’s absent in a restaurant with hundreds of such reviews.) The recommendations given by Upper Confidence Bound algorithms will be similar to those provided by the Gittins index, but they are significantly easier to compute, and they don’t require the assumption of geometric discounting.
置信上限算法实现了一项被称为“面对不确定性时的乐观主义”的原则。它们表明,乐观主义可以是完全理性的。根据目前获得的证据,这些算法专注于某个选项可能的最佳结果,从而提升了我们不太了解的可能性。因此,它们自然而然地在决策过程中注入了一丝探索的热情,满怀热情地拥抱新的选择,因为其中任何一个都可能成为下一个风口。麻省理工学院的莱斯利·凯尔布林(Leslie Kaelbling)也运用了同样的原则,她制造了“乐观机器人”,通过提升未知领域的价值来探索周围的空间。这显然也对人类生活产生了影响。
Upper Confidence Bound algorithms implement a principle that has been dubbed “optimism in the face of uncertainty.” Optimism, they show, can be perfectly rational. By focusing on the best that an option could be, given the evidence obtained so far, these algorithms give a boost to possibilities we know less about. As a consequence, they naturally inject a dose of exploration into the decision-making process, leaping at new options with enthusiasm because any one of them could be the next big thing. The same principle has been used, for instance, by MIT’s Leslie Kaelbling, who builds “optimistic robots” that explore the space around them by boosting the value of uncharted terrain. And it clearly has implications for human lives as well.
置信上限算法的成功,为“疑点利益”提供了正式的依据。遵循这些算法的建议,你应该会兴奋地结识新朋友,尝试新事物——在没有相反证据的情况下,对他们抱有最好的假设。从长远来看,乐观是预防后悔的最佳方法。
The success of Upper Confidence Bound algorithms offers a formal justification for the benefit of the doubt. Following the advice of these algorithms, you should be excited to meet new people and try new things—to assume the best about them, in the absence of evidence to the contrary. In the long run, optimism is the best prevention for regret.
土匪在线
Bandits Online
2007年,谷歌产品经理丹·西罗克(Dan Siroker)请假前往芝加哥,参加时任参议员巴拉克·奥巴马的总统竞选活动。作为“新媒体分析”团队的负责人,西罗克将谷歌的一项网络实践运用到了竞选活动的鲜红色“捐赠”按钮上。结果令人震惊:他的工作直接促成了5700万美元的额外捐款。
In 2007, Google product manager Dan Siroker took a leave of absence to join the presidential campaign of then senator Barack Obama in Chicago. Heading the “New Media Analytics” team, Siroker brought one of Google’s web practices to bear on the campaign’s bright-red DONATE button. The result was nothing short of astonishing: $57 million of additional donations were raised as a direct result of his work.
他到底对那个按钮做了什么?
What exactly did he do to that button?
他对其进行了 A/B 测试。
He A/B tested it.
A/B 测试的工作原理如下:一家公司会为某个网页设计几个不同的版本。他们可能会尝试不同的颜色或图片,不同的新闻标题,或是屏幕上项目的不同排列方式。然后,他们会随机将新用户分配到这些不同的页面,通常数量相同。一个用户可能会看到红色按钮,而另一个用户可能会看到蓝色按钮;一个用户可能会看到“捐赠”,另一个用户可能会看到“贡献” 。然后,会监控相关指标(例如,点击率或每位访客的平均收入)。一段时间后,如果观察到统计上显著的效果,通常会锁定“获胜”版本,或将其作为下一轮实验的对照。
A/B testing works as follows: a company drafts several different versions of a particular webpage. Perhaps they try different colors or images, or different headlines for a news article, or different arrangements of items on the screen. Then they randomly assign incoming users to these various pages, usually in equal numbers. One user may see a red button, while another user may see a blue one; one may see DONATE and another may see CONTRIBUTE. The relevant metrics (e.g., click-through rate or average revenue per visitor) are then monitored. After a period of time, if statistically significant effects are observed, the “winning” version is typically locked into place—or becomes the control for another round of experiments.
在奥巴马捐款页面上,Siroker 的 A/B 测试揭示了一切。对于首次访问竞选网站的访客来说,“捐款并获得礼物”按钮的效果最佳,即使将送礼成本考虑在内。对于从未捐过钱的长期时事通讯订阅者来说,“请捐款”效果最佳,或许是利用了他们的负罪感。对于过去已经捐过款的访客,“捐款”最能吸引后续捐款——其逻辑或许是,此人已经“捐过款”,但总是可以“捐”更多。在所有情况下,让竞选团队感到惊讶的是,一张简单的奥巴马家庭黑白照片的效果优于团队能想到的任何其他照片或视频。所有这些独立优化的净效应是巨大的。
In the case of Obama’s donation page, Siroker’s A/B tests were revealing. For first-time visitors to the campaign site, a DONATE AND GET A GIFT button turned out to be the best performer, even after the cost of sending the gifts was taken into account. For longtime newsletter subscribers who had never given money, PLEASE DONATE worked the best, perhaps appealing to their guilt. For visitors who had already donated in the past, CONTRIBUTE worked best at securing follow-up donations—the logic being perhaps that the person had already “donated” but could always “contribute” more. And in all cases, to the astonishment of the campaign team, a simple black-and-white photo of the Obama family outperformed any other photo or video the team could come up with. The net effect of all these independent optimizations was gigantic.
如果你在过去十年里基本上一直在使用互联网,那么你就是别人探索/利用问题的一部分。公司希望发现那些能让他们赚最多钱的东西,同时尽可能多地从中获利——探索,利用。亚马逊和谷歌等大型科技公司从2000年左右开始对其用户进行实时A/B测试,在接下来的几年里,互联网已经成为世界上最大的受控实验。这些公司在探索和利用什么?简而言之,就是你:任何让你移动鼠标并掏出钱包的东西。
If you’ve used the Internet basically at all over the past decade, then you’ve been a part of someone else’s explore/exploit problem. Companies want to discover the things that make them the most money while simultaneously making as much of it as they can—explore, exploit. Big tech firms such as Amazon and Google began carrying out live A/B tests on their users starting in about 2000, and over the following years the Internet has become the world’s largest controlled experiment. What are these companies exploring and exploiting? In a word, you: whatever it is that makes you move your mouse and open your wallet.
公司会对其网站导航、营销邮件的主题和发送时间,有时甚至会对其实际功能和定价进行 A/B 测试。如今,测试不再局限于“谷歌”的搜索算法和“亚马逊”的支付流程,而是各种难以言喻、难以捉摸的微妙组合。(谷歌曾在 2009 年为其一款工具栏测试了 41 种蓝色,这可谓臭名昭著。)在某些情况下,任何一对用户都不太可能拥有完全相同的体验。
Companies A/B test their site navigation, the subject lines and timing of their marketing emails, and sometimes even their actual features and pricing. Instead of “the” Google search algorithm and “the” Amazon checkout flow, there are now untold and unfathomably subtle permutations. (Google infamously tested forty-one shades of blue for one of its toolbars in 2009.) In some cases, it’s unlikely that any pair of users will have the exact same experience.
数据科学家、Facebook 数据部门前经理杰夫·哈默巴赫 (Jeff Hammerbacher) 曾告诉《彭博 商业周刊》:“我们这一代最优秀的人才正在思考如何让人们点击广告。” 不妨将其视为千禧一代的“嚎叫”——就像艾伦·金斯堡那句不朽的名言“我亲眼目睹我们这一代最优秀的人才被疯狂摧毁”之于“垮掉的一代”一样。哈默巴赫对此的看法是,这种情况“糟透了”。但无论人们如何看待,网络正在为点击实验科学提供可能性,而这种可能性是过去的营销人员做梦也想不到的。
Data scientist Jeff Hammerbacher, former manager of the Data group at Facebook, once told Bloomberg Businessweek that “the best minds of my generation are thinking about how to make people click ads.” Consider it the millennials’ Howl—what Allen Ginsberg’s immortal “I saw the best minds of my generation destroyed by madness” was to the Beat Generation. Hammerbacher’s take on the situation was that this state of affairs “sucks.” But regardless of what one makes of it, the web is allowing for an experimental science of the click the likes of which had never even been dreamed of by marketers of the past.
我们当然知道奥巴马在2008年大选中的遭遇。但他的分析总监丹·西罗克(Dan Siroker)又怎么样了呢?就职典礼结束后,西罗克回到了西部的加州,并与谷歌同事皮特·库曼(Pete Koomen)共同创立了网站优化公司Optimizely。到了2012年总统大选,他们的公司不仅服务于奥巴马的连任竞选团队,也服务于共和党挑战者米特·罗姆尼的竞选团队。
We know what happened to Obama in the 2008 election, of course. But what happened to his director of analytics, Dan Siroker? After the inauguration, Siroker returned west, to California, and with fellow Googler Pete Koomen co-founded the website optimization firm Optimizely. By the 2012 presidential election cycle, their company counted among its clients both the Obama re-election campaign and the campaign of Republican challenger Mitt Romney.
在首次尝试使用后的十年左右,A/B 测试已不再是秘密武器。它已成为网络商业和政治运作中根深蒂固的一部分,几乎被视为理所当然。下次打开浏览器时,你可以确信,你看到的颜色、图片、文字,甚至价格——当然还有广告——都来自一个探索/利用算法,它会根据你的点击进行调整。在这个特殊的多臂老虎机问题中,你不是赌徒,而是大奖的获得者。
Within a decade or so after its first tentative use, A/B testing was no longer a secret weapon. It has become such a deeply embedded part of how business and politics are conducted online as to be effectively taken for granted. The next time you open your browser, you can be sure that the colors, images, text, perhaps even the prices you see—and certainly the ads—have come from an explore/exploit algorithm, tuning itself to your clicks. In this particular multi-armed bandit problem, you’re not the gambler; you’re the jackpot.
A/B 测试本身的过程随着时间的推移日益完善。最标准的 A/B 设置——将流量平均分配给两个选项,运行一段时间的测试,然后将所有流量分配给获胜者——未必是解决问题的最佳算法,因为这意味着只要测试继续,一半的用户就只能选择较差的选项。而找到更好方法的回报可能非常高。目前,谷歌约 500 亿美元的年收入中,超过 90% 来自付费广告,而在线商务每年的收入高达数千亿美元。这意味着探索/利用算法在经济和技术上有效地支撑着互联网本身的很大一部分。最佳算法的争论仍然激烈,统计学家、工程师和博主们就如何在各种可能的商业场景中平衡探索和利用的最佳方式展开了无休止的争论。
The process of A/B testing itself has become increasingly refined over time. The most canonical A/B setup—splitting the traffic evenly between two options, running the test for a set period of time, and thereafter giving all the traffic to the winner—might not necessarily be the best algorithm for solving the problem, since it means half the users are stuck getting the inferior option as long as the test continues. And the rewards for finding a better approach are potentially very high. More than 90% of Google’s approximately $50 billion in annual revenue currently comes from paid advertising, and online commerce comprises hundreds of billions of dollars a year. This means that explore/exploit algorithms effectively power, both economically and technologically, a significant fraction of the Internet itself. The best algorithms to use remain hotly contested, with rival statisticians, engineers, and bloggers endlessly sparring about the optimal way to balance exploration and exploitation in every possible business scenario.
争论探索/利用问题中各种观点之间的确切区别,似乎显得无比晦涩难懂。事实上,这些区别至关重要——而且事关的不仅仅是总统选举和互联网经济。
Debating the precise distinctions among various takes on the explore/exploit problem may seem hopelessly arcane. In fact, these distinctions turn out to matter immensely—and it’s not just presidential elections and the Internet economy that are at stake.
这也是人的生命。
It’s also human lives.
临床试验正在进行中
Clinical Trials on Trial
1932年至1972年间,阿拉巴马州梅肯县数百名患有梅毒的非裔美国男性被故意拒绝接受医疗专业人员的治疗,这是美国公共卫生服务局(US Public Health Service)一项长达四十年的实验,即塔斯基吉梅毒研究(Tuskegee Syphilis Study)。1966年,公共卫生服务局员工彼得·巴克斯顿(Peter Buxtun)提出抗议。1968年,他再次提出抗议。但直到他将此事曝光给媒体——该报道于1972年7月25日刊登在《华盛顿星报》(Washington Star)上,并于第二天登上《纽约时报》头版——美国政府才最终叫停了这项研究。
Between 1932 and 1972, several hundred African-American men with syphilis in Macon County, Alabama, went deliberately untreated by medical professionals, as part of a forty-year experiment by the US Public Health Service known as the Tuskegee Syphilis Study. In 1966, Public Health Service employee Peter Buxtun filed a protest. He filed a second protest in 1968. But it was not until he broke the story to the press—it appeared in the Washington Star on July 25, 1972, and was the front-page story in the New York Times the next day—that the US government finally halted the study.
公众的强烈抗议和随后的国会听证会催生了一项旨在正式确立医学伦理原则和标准的倡议。在马里兰州充满田园气息的贝尔蒙特会议中心举行的一次委员会会议最终于1979年发布了一份文件,即《贝尔蒙特报告》。《贝尔蒙特报告》为医学实验的伦理实践奠定了基础,从而确保塔斯基吉实验——一项令人震惊且明显违反医疗行业对患者义务的不当行为——永远不会重演。但报告也指出,在许多其他案例中,界定这条界限的难度很大。
What followed the public outcry, and the subsequent congressional hearing, was an initiative to formalize the principles and standards of medical ethics. A commission held at the pastoral Belmont Conference Center in Maryland resulted in a 1979 document known as the Belmont Report. The Belmont Report lays out a foundation for the ethical practice of medical experiments, so that the Tuskegee experiment—an egregious, unambiguously inappropriate breach of the health profession’s duty to its patients—might never be repeated. But it also notes the difficulty, in many other cases, of determining exactly where the line should be drawn.
报告指出:“希波克拉底格言‘不伤害’长期以来一直是医学伦理学的基本原则。生理学家克劳德·伯纳德将其扩展到研究领域,认为无论伤害他人可能带来什么好处,都不应伤害他人。然而,即使避免伤害也需要了解什么是有害的;而在获取这些信息的过程中,人们可能会面临受到伤害的风险。”
“The Hippocratic maxim ‘do no harm’ has long been a fundamental principle of medical ethics,” the report points out. “[The physiologist] Claude Bernard extended it to the realm of research, saying that one should not injure one person regardless of the benefits that might come to others. However, even avoiding harm requires learning what is harmful; and, in the process of obtaining this information, persons may be exposed to risk of harm.”
因此,贝尔蒙特报告承认了,但并未解决在基于自身最佳知识采取行动与获取更多信息之间存在的矛盾。报告还明确指出,获取知识的价值如此之高,以至于某些常规医学伦理原则可以被搁置。报告指出,新药和新疗法的临床试验往往需要冒着损害部分患者的风险,即使已采取措施将这种风险降至最低。
The Belmont Report thus acknowledges, but does not resolve, the tension that exists between acting on one’s best knowledge and gathering more. It also makes it clear that gathering knowledge can be so valuable that some aspects of normal medical ethics can be suspended. Clinical testing of new drugs and treatments, the report notes, often requires risking harm to some patients, even if steps are taken to minimize that risk.
仁慈原则并非总是如此明确。例如,关于(儿童疾病)的研究,如果其风险超过最低限度,且无法立即为儿童带来直接益处,就存在一个棘手的伦理问题。一些人认为此类研究不可接受,而另一些人则指出,这种限制将排除许多有望在未来为儿童带来巨大益处的研究。同样,与所有棘手的案例一样,仁慈原则所涵盖的不同主张可能会发生冲突,并迫使人们做出艰难的选择。
The principle of beneficence is not always so unambiguous. A difficult ethical problem remains, for example, about research [on childhood diseases] that presents more than minimal risk without immediate prospect of direct benefit to the children involved. Some have argued that such research is inadmissible, while others have pointed out that this limit would rule out much research promising great benefit to children in the future. Here again, as with all hard cases, the different claims covered by the principle of beneficence may come into conflict and force difficult choices.
自《贝尔蒙特报告》发表以来的几十年里,一个基本问题是,开展临床试验的标准方法是否真的能够最大限度地降低患者风险。在传统的临床试验中,患者被分成几组,每组在研究期间接受不同的治疗。(只有在特殊情况下,试验才会提前终止。)这种程序专注于最终确定哪种治疗方案更好,而不是在试验本身中为每位患者提供最佳治疗方案。从这个意义上讲,它的运作方式与网站的A/B测试如出一辙,一部分人在实验过程中获得的体验最终会被证明是劣质的。但医生和科技公司一样,在试验过程中获得了一些关于哪种方案更好的信息——这些信息不仅可以用于改善试验结束后未来患者的预后,还可以用于改善当前患者的预后。
One of the fundamental questions that has arisen in the decades since the Belmont Report is whether the standard approach to conducting clinical trials really does minimize risk to patients. In a conventional clinical trial, patients are split into groups, and each group is assigned to receive a different treatment for the duration of the study. (Only in exceptional cases does a trial get stopped early.) This procedure focuses on decisively resolving the question of which treatment is better, rather than on providing the best treatment to each patient in the trial itself. In this way it operates exactly like a website’s A/B test, with a certain fraction of people receiving an experience during the experiment that will eventually be proven inferior. But doctors, like tech companies, are gaining some information about which option is better while the trial proceeds—information that could be used to improve outcomes not only for future patients beyond the trial, but for the patients currently in it.
为了找到网站的最佳配置,实验投入了数百万美元,但在临床试验中,寻找最佳治疗方法的实验却直接关系到患者的生死。越来越多的医生和统计学家认为,我们的做法是错误的:我们应该把治疗方法的选择当作一个多臂老虎机问题,即使在实验进行过程中也要努力为患者提供更好的治疗方案。
Millions of dollars are at stake in experiments to find the optimal configuration of a website, but in clinical trials, experimenting to find optimal treatments has direct life-or-death consequences. And a growing community of doctors and statisticians think that we’re doing it wrong: that we should be treating the selection of treatments as a multi-armed bandit problem, and trying to get the better treatments to people even while an experiment is in progress.
1969 年,现就职于哈佛大学的生物统计学家 Marvin Zelen 提议进行“自适应”试验。他提出的想法之一是采用随机的“玩赢家”算法——一种“赢-留-输-移”算法,其中每次获胜都会增加使用给定治疗方法的概率,每次失败都会减少。在 Zelen 的程序中,你首先要准备一顶帽子,里面装着分别代表正在研究的两种治疗方案的一个球。第一位患者的治疗方法是通过从帽子中随机抽取一个球来选择的(之后将球放回帽子中)。如果所选治疗方法成功,则将另一个代表该治疗方法的球放入帽子中——现在你有三个球,其中两个代表成功的治疗方法。如果失败,则将另一个代表另一种治疗方法的球放入帽子中,这样你更有可能选择替代方案。
In 1969, Marvin Zelen, a biostatistician who is now at Harvard, proposed conducting “adaptive” trials. One of the ideas he suggested was a randomized “play the winner” algorithm—a version of Win-Stay, Lose-Shift, in which the chance of using a given treatment is increased by each win and decreased by each loss. In Zelen’s procedure, you start with a hat that contains one ball for each of the two treatment options being studied. The treatment for the first patient is selected by drawing a ball at random from the hat (the ball is put back afterward). If the chosen treatment is a success, you put another ball for that treatment into the hat—now you have three balls, two of which are for the successful treatment. If it fails, then you put another ball for the other treatment into the hat, making it more likely you’ll choose the alternative.
十六年后,泽伦的算法首次用于临床试验,用于研究体外膜肺氧合(ECMO)——一种治疗婴儿呼吸衰竭的大胆方法。ECMO由密歇根大学的罗伯特·巴特利特于20世纪70年代开发,它将原本流向肺部的血液抽离体外,经机器氧合后再送回心脏。这是一种激进的措施,本身也存在风险(包括栓塞的可能性),但在没有其他选择的情况下,它提供了一种可行的治疗方法。1975年,ECMO挽救了加州奥兰治县一名新生女婴的生命,当时她甚至连呼吸机都无法提供足够的氧气。如今,这名女婴已过40岁生日,并已结婚生子。但在早期,ECMO技术和操作被认为具有高度实验性,早期针对成人的研究表明,与传统疗法相比,ECMO并无益处。
Zelen’s algorithm was first used in a clinical trial sixteen years later, for a study of extracorporeal membrane oxygenation, or “ECMO”—an audacious approach to treating respiratory failure in infants. Developed in the 1970s by Robert Bartlett of the University of Michigan, ECMO takes blood that’s heading for the lungs and routes it instead out of the body, where it is oxygenated by a machine and returned to the heart. It is a drastic measure, with risks of its own (including the possibility of embolism), but it offered a possible approach in situations where no other options remained. In 1975 ECMO saved the life of a newborn girl in Orange County, California, for whom even a ventilator was not providing enough oxygen. That girl has now celebrated her fortieth birthday and is married with children of her own. But in its early days the ECMO technology and procedure were considered highly experimental, and early studies in adults showed no benefit compared to conventional treatments.
1982 年至 1984 年,巴特利特 (Bartlett) 和他在密歇根大学的同事对患有呼吸衰竭的新生儿进行了一项研究。该团队明确表示,他们想要解决他们所说的“拒绝一种未经证实但可能挽救生命的治疗方法的伦理问题”,并且“不愿仅仅为了满足传统的随机分配技术而拒绝向其他患者提供挽救生命的治疗方法”。因此,他们采用了泽伦算法。该策略的结果是,一名婴儿被分配了“常规”治疗并死亡,而连续 11 名婴儿被分配了实验性的 ECMO 治疗,所有婴儿都存活了下来。1984 年 4 月至 11 月期间,在正式研究结束后,另有 10 名婴儿符合 ECMO 治疗的标准。其中 8 名接受了 ECMO 治疗,所有 8 名婴儿都存活了下来。两名接受了常规治疗,两人都死亡。
From 1982 to 1984, Bartlett and his colleagues at the University of Michigan performed a study on newborns with respiratory failure. The team was clear that they wanted to address, as they put it, “the ethical issue of withholding an unproven but potentially lifesaving treatment,” and were “reluctant to withhold a lifesaving treatment from alternate patients simply to meet conventional random assignment technique.” Hence they turned to Zelen’s algorithm. The strategy resulted in one infant being assigned the “conventional” treatment and dying, and eleven infants in a row being assigned the experimental ECMO treatment, all of them surviving. Between April and November of 1984, after the end of the official study, ten additional infants met the criteria for ECMO treatment. Eight were treated with ECMO, and all eight survived. Two were treated conventionally, and both died.
这些数字令人瞩目,然而密歇根大学关于ECMO的研究完成后不久便陷入了争议。试验中接受常规治疗的患者数量如此之少,这与标准方法论相去甚远,而且该操作本身具有高度侵入性,存在潜在风险。论文发表后,哈佛大学公共卫生学院生物统计学教授吉姆·韦尔和他的医学同事仔细检查了数据,得出结论:“在没有进一步研究的情况下,无法证明常规使用ECMO是合理的。”因此,韦尔和他的同事设计了第二个临床试验,仍然试图在知识获取和患者有效治疗之间取得平衡,但采用了不那么激进的设计。他们将患者随机分配到ECMO或常规治疗组,直到其中一组的死亡人数达到预定水平。然后,他们将研究中的所有患者转换为更有效的治疗组。
These are eye-catching numbers, yet shortly after the University of Michigan study on ECMO was completed it became mired in controversy. Having so few patients in a trial receive the conventional treatment deviated significantly from standard methodology, and the procedure itself was highly invasive and potentially risky. After the publication of the paper, Jim Ware, professor of biostatistics at the Harvard School of Public Health, and his medical colleagues examined the data carefully and concluded that they “did not justify routine use of ECMO without further study.” So Ware and his colleagues designed a second clinical trial, still trying to balance the acquisition of knowledge with the effective treatment of patients but using a less radical design. They would randomly assign patients to either ECMO or the conventional treatment until a prespecified number of deaths was observed in one of the groups. Then they would switch all the patients in the study to the more effective treatment of the two.
在Ware研究的第一阶段,接受常规治疗的10名婴儿中有4名死亡,而接受ECMO治疗的9名婴儿中,9名全部存活。这4名婴儿的死亡足以促使研究进入第二阶段,在该阶段,所有20名患者均接受了ECMO治疗,其中19名存活。Ware及其同事对此深信不疑,并得出结论:“从伦理上很难为进一步的随机化辩护。”
In the first phase of Ware’s study, four of ten infants receiving conventional treatment died, and all nine of nine infants receiving ECMO survived. The four deaths were enough to trigger a transition to the second phase, where all twenty patients were treated with ECMO and nineteen survived. Ware and colleagues were convinced, concluding that “it is difficult to defend further randomization ethically.”
但有些人在Ware研究之前就已经得出了这一结论,并对此直言不讳。批评者包括Don Berry,他是世界领先的多臂老虎机专家之一。在与Ware研究同时发表在《统计科学》杂志上的一篇评论中,Berry写道:“像Ware研究那样将患者随机分配到非ECMO治疗是不道德的……在我看来,Ware研究根本不应该进行。”
But some had already concluded this before the Ware study, and were vocal about it. The critics included Don Berry, one of the world’s leading experts on multi-armed bandits. In a comment that was published alongside the Ware study in Statistical Science, Berry wrote that “randomizing patients to non-ECMO therapy as in the Ware study was unethical.… In my view, the Ware study should not have been conducted.”
然而,即使是韦尔的研究也并未给医学界所有人带来定论。20 世纪 90 年代,又进行了一项关于 ECMO 的研究,在英国招募了近 200 名婴儿。这项研究没有使用自适应算法,而是遵循了传统方法,将婴儿随机分成两组。研究人员为这项实验辩护说,ECMO 的实用性“存在争议,因为对现有证据的解读各不相同”。事实证明,在英国,两种治疗方法之间的差异并不像那两项美国研究那样明显,但结果仍然被宣称“与之前的初步发现一致,即 ECMO 支持策略可降低死亡风险”。这种认识的代价是什么?“常规”组比接受 ECMO 治疗的组多 24 名婴儿死亡。
And yet even the Ware study was not conclusive for all in the medical community. In the 1990s yet another study on ECMO was conducted, enrolling nearly two hundred infants in the United Kingdom. Instead of using adaptive algorithms, this study followed the traditional methods, splitting the infants randomly into two equal groups. The researchers justified the experiment by saying that ECMO’s usefulness “is controversial because of varying interpretation of the available evidence.” As it turned out, the difference between the treatments wasn’t as pronounced in the United Kingdom as it had been in the two American studies, but the results were nonetheless declared “in accord with the earlier preliminary findings that a policy of ECMO support reduces the risk of death.” The cost of that knowledge? Twenty-four more infants died in the “conventional” group than in the group receiving ECMO treatment.
适应性临床试验结果普遍难以接受,这似乎令人费解。但想想看,20世纪初统计学的出现对医学的影响,它从一个医生不得不以临时的方式互相说服对方接受每一种新疗法的领域,转变为一个对哪些证据具有说服力、哪些证据不具有说服力有明确指导方针的领域。改变公认的标准统计实践,可能会至少暂时打破这种平衡。
The widespread difficulty with accepting results from adaptive clinical trials might seem incomprehensible. But consider that part of what the advent of statistics did for medicine, at the start of the twentieth century, was to transform it from a field in which doctors had to persuade each other in ad hoc ways about every new treatment into one where they had clear guidelines about what sorts of evidence were and were not persuasive. Changes to accepted standard statistical practice have the potential to upset this balance, at least temporarily.
ECMO争议之后,唐·贝里从明尼苏达大学统计系调至休斯顿的MD安德森癌症中心,在那里,他运用通过研究多臂老虎机游戏而发展起来的方法,设计了多种癌症治疗的临床试验。虽然他仍然是随机临床试验的直言不讳的批评者之一,但他绝非唯一一个。近年来,他一直为之奋斗的理念终于开始成为主流。2010年2月,美国食品药品监督管理局(FDA)发布了一份名为《药物和生物制剂自适应设计临床试验》的“指导性”文件,该文件表明——尽管FDA长期以来一直坚持他们所信赖的方案——他们或许最终愿意探索其他替代方案。
After the controversy over ECMO, Don Berry moved from the statistics department at the University of Minnesota to the MD Anderson Cancer Center in Houston, where he has used methods developed by studying multi-armed bandits to design clinical trials for a variety of cancer treatments. While he remains one of the more vocal critics of randomized clinical trials, he is by no means the only one. In recent years, the ideas he’s been fighting for are finally beginning to come into the mainstream. In February 2010, the FDA released a “guidance” document, “Adaptive Design Clinical Trials for Drugs and Biologics,” which suggests—despite a long history of sticking to an option they trust—that they might at last be willing to explore alternatives.
躁动的世界
The Restless World
一旦你熟悉了它们,我们几乎随处可见多臂老虎机。我们很少会做出孤立的决策,其结果不会为我们提供任何未来决策所需的信息。因此,我们很自然地会问,就像我们在最优停止问题上所做的那样,人们通常能多好地解决这些问题——这个问题已经被心理学家和行为经济学家在实验室里进行了广泛的探索。
Once you become familiar with them, it’s easy to see multi-armed bandits just about everywhere we turn. It’s rare that we make an isolated decision, where the outcome doesn’t provide us with any information that we’ll use to make other decisions in the future. So it’s natural to ask, as we did with optimal stopping, how well people generally tend to solve these problems—a question that has been extensively explored in the laboratory by psychologists and behavioral economists.
总的来说,人们似乎倾向于过度探索——过度偏爱新事物而非最佳事物。1966年,阿莫斯·特沃斯基和沃德·爱德华兹发表了一篇关于这一现象的简单演示,他们进行了一项实验。实验中,受试者被展示一个装有两盏灯的盒子,并被告知每盏灯会以固定(但未知)的百分比亮起。然后,受试者有1000次机会,要么观察哪盏灯亮了,要么在不观察结果的情况下对结果下注。(与更传统的老虎机问题设置不同,在这里,受试者不能同时进行既下注又观察结果的“下注”;受试者直到最后才会知道他们的下注是否有回报。)这是纯粹的探索与利用,将信息的获取与信息的利用直接对立起来。在大多数情况下,人们采取了一种合理的策略:观察一段时间,然后对看似最佳的结果下注——但他们在观察上花费的时间始终远远超出了应有的水平。究竟多花了多少时间?在一项实验中,一盏灯亮的概率为60%,另一盏灯亮的概率为40%,这种差异既不明显也不微妙。在这种情况下,人们平均选择观察505次,其余495次下注。但数学计算表明,他们应该在观察38次后就开始下注——这样一来,总共有962次机会可以赢钱。
In general, it seems that people tend to over-explore—to favor the new disproportionately over the best. In a simple demonstration of this phenomenon, published in 1966, Amos Tversky and Ward Edwards conducted experiments where people were shown a box with two lights on it and told that each light would turn on a fixed (but unknown) percentage of the time. They were then given 1,000 opportunities either to observe which light came on, or to place a bet on the outcome without getting to observe it. (Unlike a more traditional bandit problem setup, here one could not make a “pull” that was both wager and observation at once; participants would not learn whether their bets had paid off until the end.) This is pure exploration vs. exploitation, pitting the gaining of information squarely against the use of it. For the most part, people adopted a sensible strategy of observing for a while, then placing bets on what seemed like the best outcome—but they consistently spent a lot more time observing than they should have. How much more time? In one experiment, one light came on 60% of the time and the other 40% of the time, a difference neither particularly blatant nor particularly subtle. In that case, people chose to observe 505 times, on average, placing bets the other 495 times. But the math says they should have started to bet after just 38 observations—leaving 962 chances to cash in.
其他研究也得出了类似的结论。20世纪90年代,沃顿商学院的研究员罗伯特·迈耶和施勇进行了一项研究,受试者需要在两个选项之间做出选择,一个选项的收益概率已知,另一个选项未知——具体来说是两家航空公司:一家是准点率已知的老牌航空公司,另一家是尚无业绩记录的新公司。假设目标是在一段时间内最大限度地提高航班准点率,那么从数学上讲,最优策略是最初只乘坐新航空公司的航班,前提是老牌航空公司没有明显更优的条件。如果在任何时候,很明显老牌航空公司的准点率更高——也就是说,如果新选择的吉廷斯指数低于老牌航空公司的准点率——那么你应该坚决选择老牌航空公司,永不回头。 (由于在这种模式下,一旦停止乘坐新航空公司的航班,就无法获得更多信息,因此它没有机会挽回损失。)但在实验中,人们倾向于在未尝试过的航空公司表现良好时很少乘坐,而在表现不佳时则频繁乘坐。他们也没有彻底放弃这家航空公司,而是经常更换其他航班,尤其是在两家航空公司的航班都不准时起飞的情况下。所有这些都与过度探索的倾向相符。
Other studies have produced similar conclusions. In the 1990s, Robert Meyer and Yong Shi, researchers at Wharton, ran a study where people were given a choice between two options, one with a known payoff chance and one unknown—specifically two airlines, an established carrier with a known on-time rate and a new company without a track record yet. Given the goal of maximizing the number of on-time arrivals over some period of time, the mathematically optimal strategy is to initially only fly the new airline, as long as the established one isn’t clearly better. If at any point it’s apparent that the well-known carrier is better—that is, if the Gittins index of the new option falls below the on-time rate of the familiar carrier—then you should switch hard to the familiar one and never look back. (Since in this setup you can’t get any more information about the new company once you stop flying it, there is no opportunity for it to redeem itself.) But in the experiment, people tended to use the untried airline too little when it was good and too much when it was bad. They also didn’t make clean breaks away from it, often continuing to alternate, particularly when neither airline was departing on time. All of this is consistent with tending to over-explore.
最后,心理学家马克·斯泰弗斯 (Mark Steyvers)、迈克尔·李 (Michael Lee) 和 E.-J. 瓦根马克斯 (E.-J. Wagenmakers) 用一台四臂老虎机进行了一项实验,要求一组受试者在十五次机会中选择玩哪一局。然后,他们对受试者可能使用的策略进行了分类。结果表明,30% 的策略最接近最优策略,47% 的策略最接近“赢-留-输-换”策略,22% 的策略似乎在选择新策略和玩目前找到的最佳策略之间随机移动。同样,这与过度探索相符,因为“赢-留-输-换”策略以及偶尔随机尝试某个策略都会导致人们在游戏后期尝试最佳选项以外的其他策略,而此时他们应该纯粹地利用机会。
Finally, psychologists Mark Steyvers, Michael Lee, and E.-J. Wagenmakers have run an experiment with a four-armed bandit, asking a group of people to choose which arm to play over a sequence of fifteen opportunities. They then classified the strategies that participants seemed to use. The results suggested that 30% were closest to the optimal strategy, 47% most resembled Win-Stay, Lose-Shift, and 22% seemed to move at random between selecting a new arm and playing the best arm found so far. Again, this is consistent with over-exploring, as Win-Stay, Lose-Shift and occasionally trying an arm at random are both going to lead people to try things other than the best option late in the game, when they should be purely exploiting.
所以,虽然我们倾向于过早地选择新秘书,但我们似乎往往太晚才停止尝试新航空公司。然而,正如没有秘书是有代价的,过早地选择某家航空公司也有代价:世界可能会改变。
So, while we tend to commit to a new secretary too soon, it seems like we tend to stop trying new airlines too late. But just as there’s a cost to not having a secretary, there’s a cost to committing too soon to a particular airline: the world might change.
标准的多臂老虎机问题假设各臂的收益概率随时间保持不变。但这在航空公司、餐厅或其他需要人们反复做出选择的情境中并非必然成立。如果不同臂的收益概率随时间变化——这被称为“不安分的老虎机”——那么问题就会变得更加困难。(事实上,问题难度之大,以至于没有一个可完全解决该问题的可靠算法,而且人们认为永远不会有。)这种困难的部分原因在于,它不再只是简单地探索一段时间然后加以利用的问题:当世界可以改变时,继续探索可能是正确的选择。或许值得再去光顾那家你几年没光顾的令人失望的餐厅,以防它换了新老板。
The standard multi-armed bandit problem assumes that the probabilities with which the arms pay off are fixed over time. But that’s not necessarily true of airlines, restaurants, or other contexts in which people have to make repeated choices. If the probabilities of a payoff on the different arms change over time—what has been termed a “restless bandit”—the problem becomes much harder. (So much harder, in fact, that there’s no tractable algorithm for completely solving it, and it’s believed there never will be.) Part of this difficulty is that it is no longer simply a matter of exploring for a while and then exploiting: when the world can change, continuing to explore can be the right choice. It might be worth going back to that disappointing restaurant you haven’t visited for a few years, just in case it’s under new management.
亨利·戴维·梭罗在其著名散文《漫步》中,反思了他为何偏爱在家附近旅行,如何对周围的环境永不厌倦,总能在马萨诸塞州的风景中发现新奇或惊喜。“事实上,在半径十英里以内的景色,或者说午后漫步的极限,与人生七十载之间,存在着一种和谐,”他写道,“你永远不会完全熟悉它。”
In his celebrated essay “Walking,” Henry David Thoreau reflected on how he preferred to do his traveling close to home, how he never tired of his surroundings and always found something new or surprising in the Massachusetts landscape. “There is in fact a sort of harmony discoverable between the capabilities of the landscape within a circle of ten miles’ radius, or the limits of an afternoon walk, and the threescore years and ten of human life,” he wrote. “It will never become quite familiar to you.”
生活在一个躁动的世界,自身也需要一定的躁动。只要世事不断变化,你就绝不能完全停止探索。
To live in a restless world requires a certain restlessness in oneself. So long as things continue to change, you must never fully cease exploring.
尽管如此,即使在动荡的世界里,为标准版多臂老虎机问题而磨练的算法技巧仍然有用。像基廷斯指数和上限置信区间这样的策略提供了相当不错的近似解和经验法则,尤其是在收益不会随时间发生很大变化的情况下。如今,世界上许多收益可以说比以往任何时候都更加稳定。一片浆果田可能这周成熟,下一周就腐烂了,但正如安迪·沃霍尔所说,“可乐就是可乐”。在工业标准化时代,拥有通过进化调整以适应不断变化的世界的本能并不一定有用。
Still, the algorithmic techniques honed for the standard version of the multi-armed bandit problem are useful even in a restless world. Strategies like the Gittins index and Upper Confidence Bound provide reasonably good approximate solutions and rules of thumb, particularly if payoffs don’t change very much over time. And many of the world’s payoffs are arguably more static today than they’ve ever been. A berry patch might be ripe one week and rotten the next, but as Andy Warhol put it, “A Coke is a Coke.” Having instincts tuned by evolution for a world in constant flux isn’t necessarily helpful in an era of industrial standardization.
或许最重要的是,思考存在最优解的多臂老虎机问题的版本不仅能提供算法,还能提供洞见。源自该问题经典形式的概念词汇——探索/利用的张力、区间的重要性、0-0 选项的高价值、后悔的最小化——不仅为我们提供了一种理解摆在我们面前的具体问题,更让我们能够理解整个人类生活轨迹的新方式。
Perhaps most importantly, thinking about versions of the multi-armed bandit problem that do have optimal solutions doesn’t just offer algorithms, it also offers insights. The conceptual vocabulary derived from the classical form of the problem—the tension of explore/exploit, the importance of the interval, the high value of the 0–0 option, the minimization of regret—gives us a new way of making sense not only of specific problems that come before us, but of the entire arc of human life.
探索 …
Explore …
虽然实验室研究可以带来启发,但人们面临的许多重要问题的时间间隔太长,无法在实验室中进行研究。了解周围世界的结构并建立持久的社会关系都是我们一生的任务。因此,观察早期探索和晚期利用在人的一生中如何呈现的一般模式,将大有裨益。
While laboratory studies can be illuminating, the interval of many of the most important problems people face is far too long to be studied in the lab. Learning the structure of the world around us and forming lasting social relationships are both lifelong tasks. So it’s instructive to see how the general pattern of early exploration and late exploitation appears over the course of a lifetime.
任何发展心理学家都渴望理解和解释人类的一个奇怪之处是,我们需要数年时间才能变得有能力和自主。驯鹿和瞪羚在出生的那天就必须做好逃离捕食者的准备,但人类需要一年多的时间才能迈出第一步。加州大学伯克利分校发展心理学教授、《婴儿床里的科学家》一书的作者艾莉森·戈普尼克 (Alison Gopnik ) 解释了人类依赖期如此之长的原因:“它为你提供了一种解决探索/利用权衡的发展方法。”正如我们所见,玩多臂老虎机的优秀算法往往会在早期进行更多探索,并在后期利用由此获得的知识。但正如戈普尼克指出的那样,“这样做的缺点是,当你处于探索阶段时,你无法获得良好的回报。”因此童年:“童年给了你一段可以探索各种可能性的时期,你不必担心回报,因为回报由妈妈、爸爸、奶奶和保姆来照顾。”
One of the curious things about human beings, which any developmental psychologist aspires to understand and explain, is that we take years to become competent and autonomous. Caribou and gazelles must be prepared to run from predators the day they’re born, but humans take more than a year to make their first steps. Alison Gopnik, professor of developmental psychology at UC Berkeley and author of The Scientist in the Crib, has an explanation for why human beings have such an extended period of dependence: “it gives you a developmental way of solving the exploration/exploitation tradeoff.” As we have seen, good algorithms for playing multi-armed bandits tend to explore more early on, exploiting the resulting knowledge later. But as Gopnik points out, “the disadvantage of that is that you don’t get good payoffs when you are in the exploration stage.” Hence childhood: “Childhood gives you a period in which you can just explore possibilities, and you don’t have to worry about payoffs because payoffs are being taken care of by the mamas and the papas and the grandmas and the babysitters.”
将儿童仅仅视为终生算法中暂时的探索阶段,或许能为学龄前儿童的父母带来些许安慰。(汤姆有两个学龄前女儿,她们极具探索精神,他希望她们遵循的是一种后悔程度最低的算法。)但这也为儿童的理性提供了新的见解。戈普尼克指出:“如果你回顾人们对儿童的看法,你会发现他们通常认为儿童在各种方面存在认知缺陷——因为如果你考察他们的开发能力,就会发现他们看起来很糟糕。他们系不上鞋带,不擅长做长远规划,不擅长集中注意力。这些都是孩子们非常不擅长的事情。” 但随意按按钮、对新玩具非常感兴趣以及快速地从一件事跳到另一件事,这些都是孩子们非常擅长的事情。如果他们的目标是探索,这些正是他们应该做的。如果你还是个婴儿,把家里的所有东西都放进嘴里就像刻意拉动赌场里的所有把手一样。
Thinking about children as simply being at the transitory exploration stage of a lifelong algorithm might provide some solace for parents of preschoolers. (Tom has two highly exploratory preschool-age daughters, and hopes they are following an algorithm that has minimal regret.) But it also provides new insights about the rationality of children. Gopnik points out that “if you look at the history of the way that people have thought about children, they have typically argued that children are cognitively deficient in various ways—because if you look at their exploit capacities, they look terrible. They can’t tie their shoes, they’re not good at long-term planning, they’re not good at focused attention. Those are all things that kids are really awful at.” But pressing buttons at random, being very interested in new toys, and jumping quickly from one thing to another are all things that kids are really great at. And those are exactly what they should be doing if their goal is exploration. If you’re a baby, putting every object in the house into your mouth is like studiously pulling all the handles at the casino.
更普遍地说,我们对理性的直觉往往源于“利用”而非“探索”。当我们谈论决策时,我们通常只关注单个决策的即时收益——如果你把每个决策都当成最后一个决策,那么只有“利用”才有意义。但人的一生中会做出很多决定。而强调探索——追求新的而非最好的,追求刺激的而非安全的,追求随机的而非深思熟虑的——实际上才是理性的,尤其是在人生早期。
More generally, our intuitions about rationality are too often informed by exploitation rather than exploration. When we talk about decision-making, we usually focus just on the immediate payoff of a single decision—and if you treat every decision as if it were your last, then indeed only exploitation makes sense. But over a lifetime, you’re going to make a lot of decisions. And it’s actually rational to emphasize exploration—the new rather than the best, the exciting rather than the safe, the random rather than the considered—for many of those choices, particularly earlier in life.
我们认为孩子们的任性可能比我们想象的要聪明。
What we take to be the caprice of children may be wiser than we know.
…并利用
… And Exploit
我的阅读生涯已经到达了一个对于那些经历过的人来说很熟悉的节点:在我剩下的有限时间里,我应该读更多的新书,还是应该停止这种徒劳的阅读——说它徒劳是因为它是无止境的——并开始重读那些在过去曾给我带来最大快乐的书籍。
I had reached a juncture in my reading life that is familiar to those who have been there: in the allotted time left to me on earth, should I read more and more new books, or should I cease with that vain consumption—vain because it is endless—and begin to reread those books that had given me the intensest pleasure in my past.
—莉迪亚·戴维斯
—LYDIA DAVIS
与幼儿相比,另一个极端是老年人。从探索/利用困境的角度思考衰老,也能带来一些令人惊讶的洞见,让我们了解随着时间的推移,我们的生活将如何变化。
At the other extreme from toddlers we have the elderly. And thinking about aging from the perspective of the explore/exploit dilemma also provides some surprising insights into how we should expect our lives to change as time goes on.
斯坦福大学心理学教授劳拉·卡斯滕森(Laura Carstensen)的职业生涯一直在挑战我们对衰老的先入之见。她尤其研究了人们的社会关系如何以及为何会随着年龄的增长而发生变化。其基本模式显而易见:人们社交网络的规模(即人们参与的社会关系数量)几乎总是会随着时间的推移而减少。但卡斯滕森的研究彻底改变了我们对这一现象的理解。
Laura Carstensen, a professor of psychology at Stanford, has spent her career challenging our preconceptions about getting older. Particularly, she has investigated exactly how, and why, people’s social relationships change as they age. The basic pattern is clear: the size of people’s social networks (that is, the number of social relationships they engage in) almost invariably decreases over time. But Carstensen’s research has transformed how we should think about this phenomenon.
老年人社交网络规模较小的传统解释是,这只是衰老导致生活质量下降的一个例子——其原因是老年人对社会关系的贡献能力下降、身体更加脆弱,以及普遍脱离社会。但卡斯滕森认为,事实上,老年人减少社交关系是他们自己的选择。正如她所说,这种减少是“终身选择过程的结果,在这个过程中,人们策略性地、适应性地发展社交网络,以最大限度地提高社会和情感收益,并将社会和情感风险降至最低。”
The traditional explanation for the elderly having smaller social networks is that it’s just one example of the decrease in quality of life that comes with aging—the result of diminished ability to contribute to social relationships, greater fragility, and general disengagement from society. But Carstensen has argued that, in fact, the elderly have fewer social relationships by choice. As she puts it, these decreases are “the result of lifelong selection processes by which people strategically and adaptively cultivate their social networks to maximize social and emotional gains and minimize social and emotional risks.”
卡斯滕森和她的同事发现,随着年龄增长,社交网络的萎缩主要是由于“修剪”了边缘关系,转而将注意力集中在亲密朋友和家人的核心上。这个过程似乎是经过深思熟虑的:当人们接近生命终点时,他们更希望关注那些最有意义的联系。
What Carstensen and her colleagues found is that the shrinking of social networks with aging is due primarily to “pruning” peripheral relationships and focusing attention instead on a core of close friends and family members. This process seems to be a deliberate choice: as people approach the end of their lives, they want to focus more on the connections that are the most meaningful.
在一项验证这一假设的实验中,卡斯滕森和她的同事芭芭拉·弗雷德里克森要求人们选择他们愿意与之共度三十分钟的人:直系亲属、最近读过的书的作者,或者最近遇到的似乎与他们有共同兴趣的人。老年人更喜欢家庭成员;年轻人也同样兴奋于见到作者或结交新朋友。但关键的是,如果让年轻人想象他们即将搬到全国各地,他们也会更喜欢家庭成员。在另一项研究中,卡斯滕森和她的同事也从另一个角度发现了同样的结果:如果让老年人想象一项医学突破将使他们的寿命延长二十年,他们的偏好就会与年轻人的偏好变得难以区分。关键在于,这些社会偏好的差异与年龄本身无关——而是与人们对自己在与决策相关的时间段内所处位置的感知有关。
In an experiment testing this hypothesis, Carstensen and her collaborator Barbara Fredrickson asked people to choose who they’d rather spend thirty minutes with: an immediate family member, the author of a book they’d recently read, or somebody they had met recently who seemed to share their interests. Older people preferred the family member; young people were just as excited to meet the author or make a new friend. But in a critical twist, if the young people were asked to imagine that they were about to move across the country, they preferred the family member too. In another study, Carstensen and her colleagues found the same result in the other direction as well: if older people were asked to imagine that a medical breakthrough would allow them to live twenty years longer, their preferences became indistinguishable from those of young people. The point is that these differences in social preference are not about age as such—they’re about where people perceive themselves to be on the interval relevant to their decision.
对剩余时间的敏感度正是探索/利用困境的计算机科学所暗示的。我们通常认为年轻人善变,而老年人则固执己见。事实上,就他们的时间间隔而言,他们两人的行为都完全合理。刻意将社交网络精简到最有意义的关系,是对享受时间减少的理性回应。
Being sensitive to how much time you have left is exactly what the computer science of the explore/exploit dilemma suggests. We think of the young as stereotypically fickle; the old, stereotypically set in their ways. In fact, both are behaving completely appropriately with respect to their intervals. The deliberate honing of a social network down to the most meaningful relationships is the rational response to having less time to enjoy them.
认识到老年是一段“剥削”的时期,有助于我们以全新的视角看待一些典型的衰老现象。例如,上大学——一个充满未曾谋面的全新社交环境——通常是一个积极向上、令人兴奋的时期,而进入养老院——一个充满未曾谋面的全新社交环境——则可能令人痛苦。这种差异部分源于我们在人生的这些阶段处于探索/剥削的连续体中。
Recognizing that old age is a time of exploitation helps provide new perspectives on some of the classic phenomena of aging. For example, while going to college—a new social environment filled with people you haven’t met—is typically a positive, exciting time, going to a retirement home—a new social environment filled with people you haven’t met—can be painful. And that difference is partly the result of where we are on the explore/exploit continuum at those stages of our lives.
探索与利用的权衡也告诉我们如何看待长辈的建议。当你的祖父告诉你哪些餐馆不错时,你应该听取——这些都是他几十年寻觅所得的宝贵经验。但如果他每天下午5点只去同一家餐馆,你就应该大胆地去探索其他选择,即使它们可能更糟糕。
The explore/exploit tradeoff also tells us how to think about advice from our elders. When your grandfather tells you which restaurants are good, you should listen—these are pearls gleaned from decades of searching. But when he only goes to the same restaurant at 5:00 p.m. every day, you should feel free to explore other options, even though they’ll likely be worse.
或许,将晚年生活视为一个运用数十年积累知识的机会,所能带来的最深刻洞见是:生活应该随着时间的推移而变得更好。探索者为了知识而牺牲的是快乐。正如我们所见,基廷斯指数和置信上限会将鲜为人知的选择的吸引力夸大到超出我们的实际预期,因为惊喜往往能带来数倍的回报。但与此同时,这也意味着探索在大多数情况下必然会令人失望。将大部分注意力转移到自己喜欢的事物上,应该能够提高生活质量。事实似乎也确实如此:卡斯滕森发现,老年人通常对自己的社交网络更满意,而且他们的情绪健康水平通常也高于年轻人。
Perhaps the deepest insight that comes from thinking about later life as a chance to exploit knowledge acquired over decades is this: life should get better over time. What an explorer trades off for knowledge is pleasure. The Gittins index and the Upper Confidence Bound, as we’ve seen, inflate the appeal of lesser-known options beyond what we actually expect, since pleasant surprises can pay off many times over. But at the same time, this means that exploration necessarily leads to being let down on most occasions. Shifting the bulk of one’s attention to one’s favorite things should increase quality of life. And it seems like it does: Carstensen has found that older people are generally more satisfied with their social networks, and often report levels of emotional well-being that are higher than those of younger adults.
因此,作为下午晚些时候餐厅的常客,有很多值得期待的事情,品尝人生探索的成果。
So there’s a lot to look forward to in being that late-afternoon restaurant regular, savoring the fruits of a life’s explorations.
*本节基本总结:git 而 Gittins 的很好。
*The basic summary of this section: git while the Gittins’s good.
现在,如果你要查找的单词以 (a) 开头,则查找此表的开头;如果以 (v) 开头,则查找结尾。同样,如果你要查找的单词以 (ca) 开头,则查找字母 (c) 的开头;如果以 (cu) 开头,则查找该字母的结尾。其余单词亦同。等等。
Nowe if the word, which thou art desirous to finde, begin with (a) then looke in the beginning of this Table, but if with (v) looke towards the end. Againe, if thy word beginne with (ca) looke in the beginning of the letter (c) but if with (cu) then looke toward the end of that letter. And so of all the rest. &c.
—罗伯特·考德雷, 《字母表》 (1604年)
—ROBERT CAWDREY, A TABLE ALPHABETICALL (1604)
在丹尼·希利斯创立思考机器公司之前,在发明著名的连接机器并行超级计算机之前,他是麻省理工学院的一名本科生,住在学生宿舍,并对室友的袜子感到恐惧。
Before Danny Hillis founded the Thinking Machines corporation, before he invented the famous Connection Machine parallel supercomputer, he was an MIT undergraduate, living in the student dormitory, and horrified by his roommate’s socks.
与许多大学生不同,希利斯感到震惊的并非室友的卫生习惯。他并非室友没洗袜子,而是他洗了。问题在于接下来会发生什么。
What horrified Hillis, unlike many a college undergraduate, wasn’t his roommate’s hygiene. It wasn’t that the roommate didn’t wash the socks; he did. The problem was what came next.
室友从干净的洗衣篮里拿出一只袜子。接下来,他随机拿出另一只袜子。如果这只袜子和第一只不匹配,他就把它扔回去。然后,他继续这个过程,一只接一只地拿出袜子,再扔回去,直到找到和第一只匹配的袜子。
The roommate pulled a sock out of the clean laundry hamper. Next he pulled another sock out at random. If it didn’t match the first one, he tossed it back in. Then he continued this process, pulling out socks one by one and tossing them back until he found a match for the first.
如果只有10双不同的袜子,按照这种方法,平均需要拉19次才能完成第一双,再拉17次才能完成第二双。总计起来,室友预计需要去篮子里“钓鱼”110次才能完成20双袜子的配对。
With just 10 different pairs of socks, following this method will take on average 19 pulls merely to complete the first pair, and 17 more pulls to complete the second. In total, the roommate can expect to go fishing in the hamper 110 times just to pair 20 socks.
这足以让任何崭露头角的计算机科学家要求换房间。
It was enough to make any budding computer scientist request a room transfer.
现在,袜子该如何分类,这成了计算机科学家们讨论得滔滔不绝的好话题。2013年,编程网站Stack Overflow上发布了一个关于袜子的问题,引发了大约一万两千字的辩论。
Now, just how socks should be sorted is a good way get computer scientists talking at surprising length. A question about socks posted to the programming website Stack Overflow in 2013 prompted some twelve thousand words of debate.
当我们提起这个话题时,传奇密码学家、图灵奖获得者、计算机科学家罗恩·里维斯特向我们坦白道:“袜子真让我困惑!”
“Socks confound me!” confessed legendary cryptographer and Turing Award–winning computer scientist Ron Rivest to the two of us when we brought up the topic.
当时他穿着凉鞋。
He was wearing sandals at the time.
分类的狂喜
The Ecstasy of Sorting
排序是计算机的核心功能。事实上,从很多方面来说,正是排序催生了计算机的诞生。
Sorting is at the very heart of what computers do. In fact, in many ways it was sorting that brought the computer into being.
十九世纪末,美国人口每十年增长30%,美国人口普查的“调查对象”数量从1870年的5人增加到1880年的200多人。1880年的人口普查统计工作耗时八年,到1890年人口普查开始时才勉强完成。当时一位作家写道:“那些在烦人的统计纸条上辛勤工作的统计员……竟然没有变得盲目疯狂,真是个奇迹。”整个普查体系正濒临崩溃,不堪重负。必须有所行动。
In the late nineteenth century, the American population was growing by 30% every decade, and the number of “subjects of inquiry” in the US Census had gone from just five in 1870 to more than two hundred in 1880. The tabulation of the 1880 census took eight years—just barely finishing by the time the 1890 census began. As a writer at the time put it, it was a wonder “the clerks who toiled at the irritating slips of tally paper … did not go blind and crazy.” The whole enterprise was threatening to collapse under its own weight. Something had to be done.
受当时打孔火车票的启发,一位名叫赫尔曼·霍勒瑞斯(Herman Hollerith)的发明家设计了一种用打孔马尼拉纸卡存储信息的系统,并发明了一种机器,他称之为霍勒瑞斯机(Hollerith Machine),用于计数和分类信息。霍勒瑞斯于1889年获得专利,政府在1890年的人口普查中采用了霍勒瑞斯机。此前从未有人见过这样的机器。一位惊叹不已的观察者写道:“这台机器运转起来如同神磨般精准无误,但在速度上却远胜神磨。” 然而,另一位观察者则认为这项发明用途有限:“由于除了政府之外没有人会使用它,因此发明者不太可能发财致富。” 霍勒瑞斯剪下并保存的这段预言最终被证明并非完全正确。1911年,霍勒瑞斯的公司与其他几家公司合并,更名为计算-制表-记录公司(Computing-Tabulating-Recording Company)。几年后,它更名为国际商业机器公司(International Business Machines),简称IBM。
Inspired by the punched railway tickets of the time, an inventor by the name of Herman Hollerith devised a system of punched manila cards to store information, and a machine, which he called the Hollerith Machine, to count and sort them. Hollerith was awarded a patent in 1889, and the government adopted the Hollerith Machine for the 1890 census. No one had ever seen anything like it. Wrote one awestruck observer, “The apparatus works as unerringly as the mills of the Gods, but beats them hollow as to speed.” Another, however, reasoned that the invention was of limited use: “As no one will ever use it but governments, the inventor will not likely get very rich.” This prediction, which Hollerith clipped and saved, would not prove entirely correct. Hollerith’s firm merged with several others in 1911 to become the Computing-Tabulating-Recording Company. A few years later it was renamed—to International Business Machines, or IBM.
在接下来的一个世纪里,排序继续推动着计算机的发展。为“存储程序”计算机编写的第一段代码就是一个高效排序程序。事实上,正是由于计算机的排序能力超越了 IBM 的专用卡片分类机,才让美国政府相信,他们在通用机器上的巨额投资是合理的。到 20 世纪 60 年代,一项研究估计,全球超过四分之一的计算资源都用于排序。这也难怪——排序对于处理几乎任何类型的信息都至关重要。无论是查找最大还是最小、最常见还是最稀有、计数、索引、标记重复项,还是仅仅寻找所需内容,它们通常都是从排序开始的。
Sorting continued to spur the development of the computer through the next century. The first code ever written for a “stored program” computer was a program for efficient sorting. In fact, it was the computer’s ability to outsort IBM’s dedicated card-sorting machines that convinced the US government their enormous financial investment in a general-purpose machine was justified. By the 1960s, one study estimated that more than a quarter of the computing resources of the world were being spent on sorting. And no wonder—sorting is essential to working with almost any kind of information. Whether it’s finding the largest or the smallest, the most common or the rarest, tallying, indexing, flagging duplicates, or just plain looking for the thing you want, they all generally begin under the hood with a sort.
但排序甚至比这更普遍。毕竟,事物被排序的主要原因之一是为了以有用的形式呈现给人类,这意味着排序也是人类信息体验的关键。排序列表无处不在——就像问“水是什么?”的鱼一样——我们必须有意识地去感知它们。然后,我们就能随处感知它们。
But sorting is more pervasive, even, than this. After all, one of the main reasons things get sorted is to be shown in useful form to human eyes, which means that sorting is also key to the human experience of information. Sorted lists are so ubiquitous that—like the fish who asks, “What is water?”—we must consciously work to perceive them at all. And then we perceive them everywhere.
我们的电子邮件收件箱通常会显示数千条消息中的前 50 条,并按接收时间排序。当我们在 Yelp 上寻找餐馆时,会看到数百条中排名前十几条,按距离或评分排序。博客会显示按日期排序的文章列表。Facebook 新闻提要、Twitter 信息流和 Reddit 主页都以列表的形式呈现,并按某种专有标准排序。我们将 Google 和 Bing 之类的东西称为“搜索引擎”,但这有点用词不当:它们实际上是排序引擎。Google 之所以在获取全球信息方面如此占主导地位,不在于它能在数亿个网页中找到我们的文本——它 20 世纪 90 年代的竞争对手在这方面通常做得足够好——而在于它对这些网页进行了很好的排序,只向我们显示最相关的 10 个。
Our email inbox typically displays the top fifty messages of potentially thousands, sorted by time of receipt. When we look for restaurants on Yelp we’re shown the top dozen or so of hundreds, sorted by proximity or by rating. A blog shows a cropped list of articles, sorted by date. The Facebook news feed, Twitter stream, and Reddit homepage all present themselves as lists, sorted by some proprietary measure. We refer to things like Google and Bing as “search engines,” but that is something of a misnomer: they’re really sort engines. What makes Google so dominant as a means of accessing the world’s information is less that it finds our text within hundreds of millions of webpages—its 1990s competitors could generally do that part well enough—but that it sorts those webpages so well, and only shows us the most relevant ten.
在许多方面,巨大的排序列表的截断顶部是通用用户界面。
The truncated top of an immense, sorted list is in many ways the universal user interface.
计算机科学让我们能够理解所有这些情况背后的运作机制,从而帮助我们更好地理解那些我们无法保持秩序的情形——比如账单、文件、书籍、袜子等等,我们每天遇到的次数可能比我们意识到的还要多。通过量化混乱的弊端(以及好处),它还能让我们看到哪些情况我们根本不应该保持秩序。
Computer science gives us a way to understand what’s going on behind the scenes in all of these cases, which in turn can offer us some insight for those times when we are the one stuck making order—with our bills, our papers, our books, our socks, probably more times each day than we realize. By quantifying the vice (and the virtue) of mess, it also shows us the cases where we actually shouldn’t make order at all.
更重要的是,当我们开始探究时,我们会发现排序不仅仅是我们处理信息的方式,也是我们处理人的方式。或许,计算机科学在建立等级方面最出人意料地有用的地方,是在运动场和拳击场上——这就是为什么了解一些关于排序的知识或许有助于解释人类如何能够共同生活,而很少发生冲突。也就是说,排序提供了一些关于社会本质的惊人线索——社会是我们创造的另一种更大、更重要的秩序。
What’s more, when we begin looking, we see that sorting isn’t just something we do with information. It’s something we do with people. Perhaps the place where the computer science of establishing rank is most unexpectedly useful is on the sporting field and in the boxing ring—which is why knowing a little about sorting might help explain how human beings are able to live together while only occasionally coming to blows. That is to say, sorting offers some surprising clues about the nature of society—that other, larger, and more important kind of order that we make.
分类的痛苦
The Agony of Sorting
“为了降低单位产出成本,人们通常会扩大经营规模,”JC Hosken 在 1955 年发表的第一篇关于分类的科学文章中写道。这是任何商学院学生都熟悉的规模经济。但对于分类而言,规模过大往往是灾难的根源:反常的是,随着分类规模的扩大,“分类的单位成本不但不会下降,反而会上升。”分类涉及严重的规模经济,违背了我们对批量处理优点的正常直觉。为两个人做饭通常并不比为一个人做饭难,当然也比为一个人做饭两次容易。但是,比如说,整理一个有 100 本书的书架要比整理两个各有 50 本书的书架花费的时间更长:你需要整理的东西是原来的两倍,每个书架可以摆放的地方也是原来的两倍。你整理的东西越多,情况就越糟。
“To lower costs per unit of output, people usually increase the size of their operations,” wrote J. C. Hosken in 1955, in the first scientific article published on sorting. This is the economy of scale familiar to any business student. But with sorting, size is a recipe for disaster: perversely, as a sort grows larger, “the unit cost of sorting, instead of falling, rises.” Sorting involves steep diseconomies of scale, violating our normal intuitions about the virtues of doing things in bulk. Cooking for two is typically no harder than cooking for one, and it’s certainly easier than cooking for one person twice. But sorting, say, a shelf of a hundred books will take you longer than sorting two bookshelves of fifty apiece: you have twice as many things to organize, and there are twice as many places each of them could go. The more you take on, the worse it gets.
这是排序理论的第一个也是最基本的见解。规模会带来伤害。
This is the first and most fundamental insight of sorting theory. Scale hurts.
由此我们可以推断,减少分类带来的痛苦和折磨,关键在于减少需要分类的衣物数量。的确如此:预防袜子分类计算难度的最佳方法之一就是更频繁地洗衣服。比如说,洗衣服的频率增加三倍,就能将分类开销降低九倍。事实上,如果希利斯的室友坚持他独特的做法,但洗衣服的间隔时间从十四天改为十三天,仅此一项就能让他少洗二十八次袜子。(而洗衣服的间隔时间只要多一天,他就能多洗三十次袜子。)
From this we might infer that minimizing our pain and suffering when it comes to sorting is all about minimizing the number of things we have to sort. It’s true: one of the best preventives against the computational difficulty of sock sorting is just doing your laundry more often. Doing laundry three times as frequently, say, could reduce your sorting overhead by a factor of nine. Indeed, if Hillis’s roommate stuck with his peculiar procedure but went thirteen days between washes instead of fourteen, that alone would save him twenty-eight pulls from the hamper. (And going just a single day longer between washes would cost him thirty pulls more.)
即使是在如此适度的、每两周一次的范围内,我们也能看到分类的规模开始变得难以承受。然而,计算机必须例行公事地一次性对数百万件物品进行分类。为此,正如《大白鲨》中的台词所说,我们需要一艘更大的船——以及一个更好的算法。
Even at such a modest, fortnightly scope we can see the scale of sorting beginning to grow untenable. Computers, though, must routinely sort millions of items in a single go. For that, as the line from Jaws puts it, we’re going to need a bigger boat—and a better algorithm.
但要回答我们究竟应该如何排序,以及哪种方法最有效,我们首先需要弄清楚其他问题:我们如何保持得分。
But to answer the question of just how we ought to be sorting, and which methods come out on top, we need to figure out something else first: how we’re going to keep score.
Big-O:最坏情况的标准
Big-O: A Yardstick for the Worst Case
吉尼斯世界纪录将纸牌分类的纪录归于捷克魔术师兹德涅克·布拉达奇。2008年5月15日,布拉达奇仅用36.16秒就完成了一副52张牌的纸牌分类。*他是如何做到的?他使用了什么样的分类技术?尽管答案可能会为分类理论带来一些有趣的见解,但布拉达奇拒绝置评。
The Guinness Book of World Records attributes the record for sorting a deck of cards to the Czech magician Zdeněk Bradáč. On May 15, 2008, Bradáč sorted a 52-card deck in just 36.16 seconds.* How did he do it? What sorting technique delivered him the title? Though the answer would shed interesting light on sorting theory, Bradáč declined to comment.
我们对布拉达奇的技巧和灵巧敬佩不已,但我们100%确信:我们能够亲自打破他的纪录。事实上,我们100%确信我们能够创造一项不可打破的纪录。我们只需要大约80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000,000次尝试即可。这个数字略大于80的10次方,是52的阶乘,用数学符号表示就是“52!”——一副52张牌可能的排列方式数量。经过大约这么多次尝试,我们迟早会得到一副完全随机排列的洗好的牌。此时,我们可以自豪地将克里斯蒂安·格里菲斯的成绩载入吉尼斯世界纪录,同时将他的成绩定格为 0 分 0 秒,成绩还算不错。
While we have nothing but respect for Bradáč’s skill and dexterity, we are 100% certain of the following: we can personally break his record. In fact, we are 100% certain that we can attain an unbreakable record. All we need are about 80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000 attempts at the title. This number, a bit over 80 unvigintillion, is 52 factorial, or “52!” in mathematical notation—the number of ways that a deck of 52 cards can possibly be ordered. By taking roughly that many attempts, sooner or later we are bound to start with a shuffled deck that is in fact completely sorted by chance. At that point we can proudly enter Christian-Griffiths into The Guinness Book alongside a not-too-shabby sort time of 0m00s.
平心而论,我们几乎肯定会一直尝试到宇宙热寂才会打破完美的纪录。然而,这也凸显了纪录保持者和计算机科学家之间最大的根本区别。吉尼斯的那些老兄们只关心最佳表现(和啤酒)。当然,他们也难辞其咎:体育界的所有纪录都反映了单次最佳表现。然而,计算机科学几乎从不关心最佳表现。相反,计算机科学家可能想知道像布拉达奇这样的人的平均排序时间:让他对所有80个(无维金的十亿分之一)的牌组进行排序,或者一个合理大小的样本,然后根据他所有尝试的平均速度给他打分。(你就能明白为什么他们不让计算机科学家运行这些程序了。)
To be fair, we’d almost certainly be trying until the heat death of the universe before we got our perfect record attempt. Nonetheless, this highlights the biggest fundamental difference between record keepers and computer scientists. The fine folks at Guinness care only about best-case performance (and beer). They’re hardly blameworthy, of course: all records in sports reflect the single best performance. Computer science, however, almost never cares about the best case. Instead, computer scientists might want to know the average sort time of someone like Bradáč: get him to sort all of the 80 unvigintillion deck orders, or a reasonably sized sample, and score him on his average speed across all attempts. (You can see why they don’t let computer scientists run these things.)
此外,计算机科学家会想知道最坏的排序时间。最坏情况分析让我们能够做出严格的保证:关键进程将按时完成,截止日期不会被错过。因此,在本章的其余部分——实际上,也是本书的其余部分——除非另有说明,我们将只讨论算法的最坏情况性能。
Moreover, a computer scientist would want to know the worst sort time. Worst-case analysis lets us make hard guarantees: that a critical process will finish in time, that deadlines won’t be blown. So for the rest of this chapter—and the rest of this book, actually—we will be discussing only algorithms’ worst-case performance, unless noted otherwise.
计算机科学已经开发出一种专门用于衡量算法最坏情况的简写方法:它被称为“大O”符号。大O符号有一个独特的特点,那就是它在设计上并不精确。也就是说,大O符号不是用分钟和秒来表达算法的性能,而是提供了一种方法来描述问题规模与程序运行时间之间的关系。由于大O符号刻意地舍弃了细节,它最终呈现出一种将问题划分为不同大类的模式。
Computer science has developed a shorthand specifically for measuring algorithmic worst-case scenarios: it’s called “Big-O” notation. Big-O notation has a particular quirk, which is that it’s inexact by design. That is, rather than expressing an algorithm’s performance in minutes and seconds, Big-O notation provides a way to talk about the kind of relationship that holds between the size of the problem and the program’s running time. Because Big-O notation deliberately sheds fine details, what emerges is a schema for dividing problems into different broad classes.
想象一下,你正在举办一场有n 位宾客的晚宴。为迎接宾客而打扫房间所需的时间与宾客人数完全无关。这类问题堪称最乐观的一类:被称为“大 O 符号”,写作O (1),也被称为“常数时间”。值得注意的是,大 O 符号根本不关心打扫实际需要多长时间——它始终相同,与宾客名单完全无关。无论有一位宾客,还是有十位、一百位或其他n位宾客,你要做的工作都是一样的。
Imagine you’re hosting a dinner party with n guests. The time required to clean the house for their arrival doesn’t depend on the number of guests at all. This is the rosiest class of problems there is: called “Big-O of one,” written O(1), it is also known as “constant time.” Notably, Big-O notation doesn’t care a whit how long the cleaning actually takes—just that it’s always the same, totally invariant of the guest list. You’ve got the same work to do if you have one guest as if you have ten, a hundred, or any other n.
现在,将烤肉传递到餐桌所需的时间将是“ n的大 O ”,写作O ( n ),也称为“线性时间”——客人数量增加一倍,您等待菜肴的时间也会增加一倍。同样,大 O 表示法根本不关心上菜的数量,也不在乎是否会有人再来一份。在每种情况下,时间仍然与客人名单的大小线性相关——如果您绘制客人数量与所用时间的图表,它将是一条直线。此外,在大 O 表示法中,任何线性时间因素的存在都会淹没所有常数时间因素。也就是说,对计算机科学家来说,将烤肉传递到餐桌一圈,或者花三个月改造餐厅,然后将烤肉传递到餐桌一圈,这两者实际上是等价的。如果这看起来很疯狂,请记住,计算机处理的n值可能很容易达到数千、数百万或数十亿。换句话说,计算机科学家正在考虑非常非常盛大的聚会。宾客名单上有数百万人,仅仅传递一次吐槽大会,就足以让房屋改造显得微不足道。
Now, the time required to pass the roast around the table will be “Big-O of n,” written O(n), also known as “linear time”—with twice the guests, you’ll wait twice as long for the dish to come around. And again, Big-O notation couldn’t care less about the number of courses that get served, or whether they go around for second helpings. In each case, the time still depends linearly on the guest list size—if you drew a graph of the number of guests vs. the time taken, it would be a straight line. What’s more, the existence of any linear-time factors will, in Big-O notation, swamp all constant-time factors. That is to say, passing the roast once around the table, or remodeling your dining room for three months and then passing the roast once around the table, are both, to a computer scientist, effectively equivalent. If that seems crazy, remember that computers deal with values of n that could easily be in the thousands, millions, or billions. In other words, computer scientists are thinking about very, very big parties. With a guest list in the millions, passing the roast once around would indeed make the home remodel seem dwarfed to the point of insignificance.
如果客人到来时,每个人都拥抱其他人以示欢迎,会怎么样?你的第一位客人拥抱你;第二位客人拥抱你两次;第三位客人拥抱你三次。一共会有多少个拥抱?这实际上是“n 平方的大 O ” ,写作O ( n² ),也称为“二次时间”。在这里,我们只关心n和时间之间关系的基本轮廓。每人拥抱两次的时间复杂度不是O (2n² ) ,拥抱加上传递食物的时间复杂度也不是 O(n² + n),拥抱加上打扫房间的时间复杂度也不是O ( n² + 1 ) 。这都是二次时间,所以O ( n² )涵盖了所有内容。
What if, as the guests arrived, each one hugged the others in greeting? Your first guest hugs you; your second guest has two hugs to give; your third guest, three. How many hugs will there be in total? This turns out to be “Big-O of n-squared,” written O(n2) and also known as “quadratic time.” Here again, we only care about the basic contours of the relationship between n and time. There’s no O(2n2) for two hugs apiece, or O(n2 + n) for hugs plus passing the food around, or O(n2 + 1) for hugs plus home cleaning. It’s all quadratic time, so O(n2) covers everything.
常数时间,写作 O(1);线性时间,写作 O(n);二次时间,写作 O(n 2 )。
Constant time, written O(1); linear time, written O(n); and quadratic time, written O(n2).
情况越来越糟。出现了“指数时间”,即O (2n ),每多一位客人,你的工作量就会翻倍。更糟糕的是“阶乘时间”,即O ( n !),这类问题实在是太难了,以至于计算机科学家只有在开玩笑的时候才会谈论它——就像我们想象洗牌直到排序一样——或者当他们真的非常希望自己开玩笑的时候。
It gets worse from there. There’s “exponential time,” O(2n), where each additional guest doubles your work. Even worse is “factorial time,” O(n!), a class of problems so truly hellish that computer scientists only talk about it when they’re joking—as we were in imagining shuffling a deck until it’s sorted—or when they really, really wish they were.
正方形:冒泡排序和插入排序
The Squares: Bubble Sort and Insertion Sort
2007年,时任参议员的奥巴马访问谷歌时,谷歌首席执行官埃里克·施密特开玩笑地像面试一样开始了问答环节,他问奥巴马:“对一百万个32位整数进行排序的最佳方法是什么?” 奥巴马毫不犹豫地苦笑了一下,回答道:“我认为冒泡排序法不太合适。” 谷歌工程师们爆发出欢呼声。“他在冒泡排序法上胜过我,”其中一位后来回忆道。
When then senator Obama visited Google in 2007, CEO Eric Schmidt jokingly began the Q&A like a job interview, asking him, “What’s the best way to sort a million thirty-two-bit integers?” Without missing a beat, Obama cracked a wry smile and replied, “I think the Bubble Sort would be the wrong way to go.” The crowd of Google engineers erupted in cheers. “He had me at Bubble Sort,” one later recalled.
奥巴马避开冒泡排序是正确的,这种算法已经成为计算机科学专业学生的出气筒:它简单、直观,但效率极低。
Obama was right to eschew Bubble Sort, an algorithm which has become something of a punching bag for computer science students: it’s simple, it’s intuitive, and it’s extremely inefficient.
假设你想按字母顺序排列你未排序的书籍。一个自然的方法是扫描整个书架,寻找乱序的书籍对——例如,先是Wallace,然后是Pynchon——然后将它们翻转。将Pynchon放在Wallace前面,然后继续扫描,每次扫描到书架末尾时,就循环回到书架的开头。当你扫描完整个书架,没有再找到任何乱序的书籍对时,你就知道任务完成了。
Imagine you want to alphabetize your unsorted collection of books. A natural approach would be just to scan across the shelf looking for out-of-order pairs—Wallace followed by Pynchon, for instance—and flipping them around. Put Pynchon ahead of Wallace, then continue your scan, looping around to the beginning of the shelf each time you reach the end. When you make a complete pass without finding any more out-of-order pairs on the entire shelf, then you know the job is done.
这就是冒泡排序,它需要二次方的时间。有n本书,它们的顺序是乱序的,每次扫描书架最多可以将每本书移动一个位置。(我们发现一个小问题,做一点小修复。)所以在最坏的情况下,即书架完全向后,至少有一本书需要移动n 个位置。因此,最多需要n 次扫描n本书,在最坏的情况下,复杂度为O ( n² )。 *这并不可怕——首先,它比我们之前的 O(n!) 洗牌直到排序的想法要好得多(如果你需要计算机科学来证实这一点的话)。但同样,这个平方项很快就会变得令人生畏。例如,这意味着对五个书架上的书进行排序所花的时间不是对一个书架进行排序的五倍,而是二十五倍。
This is Bubble Sort, and it lands us in quadratic time. There are n books out of order, and each scan through the shelf can move each one at most one position. (We spot a tiny problem, make a tiny fix.) So in the worst case, where the shelf is perfectly backward, at least one book will need to be moved n positions. Thus a maximum of n passes through n books, which gives us O(n2) in the worst case.* It’s not terrible—for one thing, it’s worlds better than our O(n!) shuffle-till-it’s-sorted idea from earlier (in case you needed computer science to confirm that). But all the same, that squared term can get daunting quickly. For instance, it means that sorting five shelves of books will take not five times as long as sorting a single shelf, but twenty-five times as long.
你可以采取不同的策略——把书架上的所有书都取下来,然后一本一本地放回原位。你把第一本书放在书架中间,然后拿起第二本书,与第一本书比较,把它放在右边或左边。拿起第三本书,从左到右浏览书架上的书,直到找到合适的位置。重复这个过程,逐渐地,书架上的所有书都整理好了,你就完成了。
You might take a different tack—pulling all the books off the shelf and putting them back in place one by one. You’d put the first book in the middle of the shelf, then take the second and compare it to the first, inserting it either to the right or to the left. Picking up the third book, you’d run through the books on the shelf from left to right until you found the right spot to tuck it in. Repeating this process, gradually all of the books would end up sorted on the shelf and you’d be done.
计算机科学家恰当地将此称为插入排序。好消息是,它可以说比冒泡排序更直观,而且没有冒泡排序那么坏的名声。坏消息是,它实际上并没有快多少。你仍然需要对每本书进行一次插入。并且每次插入仍然需要平均经过书架上大约一半的书才能找到正确的位置。虽然在实践中插入排序确实比冒泡排序快一点,但我们再次确定,如果你愿意的话,时间是平方级的。对超过一个书架的任何东西进行排序仍然是一个难以处理的问题。
Computer scientists call this, appropriately enough, Insertion Sort. The good news is that it’s arguably even more intuitive than Bubble Sort and doesn’t have quite the bad reputation. The bad news is that it’s not actually that much faster. You still have to do one insertion for each book. And each insertion still involves moving past about half the books on the shelf, on average, to find the correct place. Although in practice Insertion Sort does run a bit faster than Bubble Sort, again we land squarely, if you will, in quadratic time. Sorting anything more than a single bookshelf is still an unwieldy prospect.
打破二次障碍:分而治之
Breaking the Quadratic Barrier: Divide and Conquer
此时,看到两种完全合理的方法陷入不可持续的二次时间,我们很自然地会怀疑是否有可能实现更快的排序。
At this point, having seen two entirely sensible approaches fall into unsustainable quadratic time, it’s natural to wonder whether faster sorting is even possible.
这个问题听起来像是关于生产力的。但与计算机科学家交谈后,却发现它更接近形而上学——类似于思考光速、时间旅行、超导体或热力学熵。宇宙的基本规则和极限是什么?什么是可能的?什么是被允许的?通过这种方式,计算机科学家与粒子物理学家和宇宙学家一样,正在窥见上帝的蓝图。创造秩序所需的最小努力是什么?
The question sounds like it’s about productivity. But talk to a computer scientist and it turns out to be closer to metaphysics—akin to thinking about the speed of light, time travel, superconductors, or thermodynamic entropy. What are the universe’s fundamental rules and limits? What is possible? What is allowed? In this way computer scientists are glimpsing God’s blueprints every bit as much as the particle physicists and cosmologists. What is the minimum effort requred to make order?
我们能否找到一种常数时间排序算法,时间复杂度为O (1),能够(就像在一大群客人到来之前打扫房间一样)在相同的时间内对任意大小的列表进行排序?嗯,即使只是确认一个书架上有n本书是否已排序,也不可能在常数时间内完成,因为这需要检查所有n本书。因此,实际上在常数时间内对这些书进行排序似乎是不可能的。
Could we find a constant-time sort, O(1), one that (like cleaning the house before the bevy of guests arrive) can sort a list of any size in the same amount of time? Well, even just confirming that a shelf of n books is sorted cannot be done in constant time, since it requires checking all n of them. So actually sorting the books in constant time seems out of the question.
那么线性时间排序O ( n ) 怎么样呢?它的效率就像在桌子上传递盘子一样,将要排序的物品数量加倍,工作量也加倍?思考一下上面的例子,很难想象这是如何实现的。每种情况下的n²都来自于需要移动n本书的事实,每次移动所需的工作量也与n成比例。我们如何将大小为n的n 次移动减少到仅仅n本身?在冒泡排序中,我们的O ( n² ) 运行时间来自于处理n本书中的每一本并将它们每本移动n个位置。在插入排序中,二次运行时间来自于处理n本书中的每一本并将它们与多达n本的其他书籍进行比较,然后再插入它们。线性时间排序意味着处理每本书都需要恒定的时间,而不管需要在多少本书中找到它的位置。这似乎不太可能。
What about a linear-time sort, O(n), as efficient as passing a dish around a table, where doubling the number of items to sort merely doubles the work? Thinking about the examples above, it’s tough to imagine how that might work either. The n2 in each case comes from the fact that you need to move n books, and the work required in each move scales with n as well. How would we get from n moves of size n down to just n by itself? In Bubble Sort, our O(n2) running time came from handling each of the n books and moving them as many as n places each. In Insertion Sort, quadratic running time came from handling each of the n books and comparing them to as many as n others before inserting them. A linear-time sort means handling each book for constant time regardless of how many others it needs to find its place among. Doesn’t seem likely.
所以我们知道,我们至少可以做到和二次时间一样好,但可能不如线性时间。也许我们的极限介于线性时间和二次时间之间。有没有介于线性和二次时间之间、n和n × n之间的算法?
So we know that we can do at least as well as quadratic time, but probably not as well as linear time. Perhaps our limit lies somewhere between linear time and quadratic time. Are there any algorithms between linear and quadratic, between n and n × n?
有——而且它们就藏在显而易见的地方。
There are—and they were hiding in plain sight.
正如我们之前提到的,信息处理始于19世纪的美国人口普查,当时赫尔曼·霍勒瑞斯(Herman Hollerith)和后来的IBM开发了实体穿孔卡片分类设备。1936年,IBM开始生产一系列名为“整理机”的机器,可以将两叠单独排序的卡片合并成一叠。只要两叠卡片本身已经排序,将它们合并成一叠排序完毕的卡片的过程就非常简单,并且只花费线性时间:只需比较最上面的两张卡片,将较小的卡片移到新的卡片叠中,然后重复此过程直至完成。
As we mentioned earlier, information processing began in the US censuses of the nineteenth century, with the development, by Herman Hollerith and later by IBM, of physical punch-card sorting devices. In 1936, IBM began producing a line of machines called “collators” that could merge two separately ordered stacks of cards into one. As long as the two stacks were themselves sorted, the procedure of merging them into a single sorted stack was incredibly straightforward and took linear time: simply compare the two top cards to each other, move the smaller of them to the new stack you’re creating, and repeat until finished.
约翰·冯·诺依曼于1945年编写了一个程序,用于展示存储程序计算机的强大功能,该程序将整理的理念发挥到了极致,堪称完美。对两张牌进行排序很简单:只需将较小的牌放在最上面即可。给定一对两张牌叠,两张牌都已排序,你可以轻松地将它们整理成一个有序的四叠牌叠。重复几次这个技巧,你就能整理出越来越大的叠,每一叠都已排序。很快,你就能整理出一副完美排序的完整牌组——最后进行一次高潮合并,就像洗牌的顺序创建过程一样,最终得到你想要的结果。
The program that John von Neumann wrote in 1945 to demonstrate the power of the stored-program computer took the idea of collating to its beautiful and ultimate conclusion. Sorting two cards is simple: just put the smaller one on top. And given a pair of two-card stacks, both of them sorted, you can easily collate them into an ordered stack of four. Repeating this trick a few times, you’d build bigger and bigger stacks, each one of them already sorted. Soon enough, you could collate yourself a perfectly sorted full deck—with a final climactic merge, like a riffle shuffle’s order-creating twin, producing the desired result.
这种方法如今被称为归并排序,它是计算机科学中的传奇算法之一。正如1997年的一篇论文所述:“归并排序在排序史上的重要性,如同排序在计算史上的重要性一样。”
This approach is known today as Mergesort, one of the legendary algorithms in computer science. As a 1997 paper put it, “Mergesort is as important in the history of sorting as sorting in the history of computing.”
归并排序的强大之处在于它最终的复杂度介于线性和二次方时间之间——具体来说,就是O ( nlogn ),即“线性对数”时间。每遍卡片都会使排序后的卡片堆大小翻倍,因此要完全排序n 张卡片,你需要进行与数字 2 乘以自身等于n所需的遍历次数相同:换句话说,n 是以二为底的对数。两次排序最多可以排序四张卡片,第三次最多可以排序八张卡片,第四次最多可以排序十六张卡片。归并排序的分而治之方法启发了许多其他线性对数排序算法,这些算法很快便应运而生。说线性对数复杂度是对二次方复杂度的改进,这是一种极其轻描淡写的说法。比如,在对人口普查级别的项目进行排序的情况下,它就像对数据集进行二十九遍……和对三亿遍的排序之间的区别。难怪它是解决大规模工业排序问题的首选方法。
The power of Mergesort comes from the fact that it indeed ends up with a complexity between linear and quadratic time—specifically, O(n log n), known as “linearithmic” time. Each pass through the cards doubles the size of the sorted stacks, so to completely sort n cards you’ll need to make as many passes as it takes for the number 2, multiplied by itself, to equal n: the base-two logarithm, in other words. You can sort up to four cards in two collation passes, up to eight cards with a third pass, and up to sixteen cards with a fourth. Mergesort’s divide-and-conquer approach inspired a host of other linearithmic sorting algorithms that quickly followed on its heels. And to say that linearithmic complexity is an improvement on quadratic complexity is a titanic understatement. In the case of sorting, say, a census-level number of items, it’s the difference between making twenty-nine passes through your data set … and three hundred million. No wonder it’s the method of choice for large-scale industrial sorting problems.
归并排序在小规模的家庭排序问题中也有实际应用。它如此广泛使用的原因之一是它很容易并行化。如果你还在为书架的摆放制定策略,那么归并排序的解决方案是订一份披萨,邀请几个朋友过来。把书均匀地分起来,让每个人整理好自己的那摞书。然后,大家分成两人一组,让他们把各自的那摞书合并起来。重复此过程,直到只剩下两摞书,最后一次把它们合并到书架上。不过,尽量不要让披萨把书弄脏。
Mergesort also has real applications in small-scale domestic sorting problems. Part of the reason why it’s so widely used is that it can easily be parallelized. If you’re still strategizing about that bookshelf, the Mergesort solution would be to order a pizza and invite over a few friends. Divide the books evenly, and have each person sort their own stack. Then pair people up and have them merge their stacks. Repeat this process until there are just two stacks left, and merge them one last time onto the shelf. Just try to avoid getting pizza stains on the books.
超越比较:超越对数
Beyond Comparison: Outsmarting the Logarithm
在华盛顿州普雷斯顿镇附近一个不起眼的工业园区里,藏在众多不起眼的灰色入口后面,矗立着2011年和2013年美国国家图书馆分类冠军的宝座。一条长长的分段式传送带每分钟传送167本书,相当于每天8.5万本书,通过条形码扫描器,这些书会被自动送入弹舱门,然后落入96个书箱中的一个。
In an inconspicuous industrial park near the town of Preston, Washington, tucked behind one nondescript gray entrance of many, lies the 2011 and 2013 National Library Sorting Champion. A long, segmented conveyor belt moves 167 books a minute—85,000 a day—through a bar code scanner, where they are automatically diverted into bomb-bay doors that drop into one of 96 bins.
归并排序的实际应用。给定一个书架,上面有八本未排序的书。首先,将相邻的书按顺序排列成对。然后,将这些对整理成四本为一组的有序集合,最后将这些集合整理成一个完全排序的书架。
A Mergesort in action. Given a shelf of eight unsorted books, start by putting adjacent books into sorted pairs. Then collate the pairs into ordered sets of four, and finally collate those sets to get a fully sorted shelf.
普雷斯顿图书分类中心是全球规模最大、效率最高的图书分类设施之一。它由金县图书馆系统运营,该系统与装备类似的纽约公共图书馆展开了良性竞争,四年来一直保持着不败战绩。“金县图书馆今年赢了我们?”纽约公共图书馆图书运营部副主任萨尔瓦托·马加迪诺在2014年摊牌前说道,“算了吧。”
The Preston Sort Center is one of the biggest and most efficient book-sorting facilities in the world. It’s run by the King County Library System, which has begun a healthy rivalry with the similarly equipped New York Public Library, with the title going back and forth over four closely contested years. “King County Library beating us this year?” said the NYPL’s deputy director of BookOps, Salvatore Magaddino, before the 2014 showdown. “Fuhgeddaboutit.”
从理论家的角度来看,普雷斯顿分拣中心也有一些令人印象深刻的地方。经过该系统的书籍分拣时间复杂度为O ( n )——线性时间。
There’s something particularly impressive about the Preston Sort Center from a theoretician’s point of view, too. The books going through its system are sorted in O(n)—linear time.
从某种意义上来说,归并排序提供的O ( nlogn )线性对数时间复杂度确实是我们所能期望的最优值。事实证明,如果我们想通过一系列头对头比较对n 个元素进行完全排序,那么比较次数绝对不可能少于O ( nlogn )次。这是宇宙的基本定律,没有其他方法可以绕过它。
In an important sense, the O(n log n) linearithmic time offered by Mergesort is truly the best we can hope to achieve. It’s been proven that if we want to fully sort n items via a series of head-to-head comparisons, there’s just no way to compare them any fewer than O(n log n) times. It’s a fundamental law of the universe, and there are no two ways around it.
但严格来说,这并不意味着排序就此终结。因为有时你不需要一个完全有序的集合——有时排序甚至不需要任何元素间的比较。这两个原则结合起来,使得在比线性对数时间更快的时间内进行粗略的实际排序成为可能。桶排序算法完美地证明了这一点——普雷斯顿排序中心就是一个完美的例证。
But this doesn’t, strictly speaking, close the book on sorting. Because sometimes you don’t need a fully ordered set—and sometimes sorting can be done without any item-to-item comparisons at all. These two principles, taken together, allow for rough practical sorts in faster than linearithmic time. This is beautifully demonstrated by an algorithm known as Bucket Sort—of which the Preston Sort Center is a perfect illustration.
在桶排序中,项目被分组到多个已排序的类别中,无需考虑更精细的类别内排序;这些可以稍后再进行。(在计算机科学中,“桶”一词仅指一块未排序的数据,但在现实世界中,桶排序的一些最强大的应用,例如在 KCLS,完全是从字面上理解这个名称的。)关键在于:如果要将n 个项目分组到m 个桶中,则可以在O ( nm ) 时间内完成分组- 也就是说,时间与项目数量乘以桶数量成正比。并且,只要桶的数量相对于项目数量较小,大 O 符号就会将其四舍五入为O ( n ),即线性时间。
In Bucket Sort, items are grouped together into a number of sorted categories, with no regard for finer, intracategory sorting; that can come later. (In computer science the term “bucket” simply refers to a chunk of unsorted data, but some of the most powerful real-world uses of Bucket Sort, as at the KCLS, take the name entirely literally.) Here’s the kicker: if you want to group n items into m buckets, the grouping can be done in O(nm) time—that is, the time is simply proportional to the number of items times the number of buckets. And as long as the number of buckets is relatively small compared to the number of items, Big-O notation will round that to O(n), or linear time.
打破线性对数障碍的关键在于了解你要分类的物品的分布情况。选择不当的桶不会让你比刚开始时好多少;比如,如果所有的书都放在同一个箱子里,你就没有任何进展。然而,选择合适的桶会将你的物品分成大小大致相等的组,考虑到分类的根本性质“规模有害”,这是朝着完整分类迈出的一大步。在普雷斯顿分类中心,他们的工作是按照目的地分馆而不是字母顺序对书籍进行分类,桶的选择取决于流通统计数据。有些分馆的流通量比其他分馆大,所以它们可能会被分配两个甚至三个箱子。
The key to actually breaking the linearithmic barrier is knowing the distribution from which the items you’re sorting are drawn. Poorly chosen buckets will leave you little better than when you started; if all the books end up in the same bin, for instance, you haven’t made any progress at all. Well-chosen buckets, however, will divide your items into roughly equal-sized groups, which—given sorting’s fundamental “scale hurts” nature—is a huge step toward a complete sort. At the Preston Sort Center, whose job is to sort books by their destination branch, rather than alphabetically, the choice of buckets is driven by circulation statistics. Some branches have a greater circulation volume than others, so they may have two bins allocated to them, or even three.
对材料的类似了解对人类分类员来说也很有用。为了见识分类专家的实际工作,我们实地考察了加州大学伯克利分校的 Doe 和 Moffitt 图书馆,那里有长达 52 英里的书架需要整理——而且全部由手工完成。归还到图书馆的书籍首先被放置在后台区域,并根据国会图书馆的索书号分配到指定的书架上。例如,一组书架上堆放着所有最近归还的书籍,索书号为 PS3000–PS9999。然后,学生助手将这些书籍装上推车,将最多 150 本书按正确顺序放回图书馆书架。学生们接受了一些分类方面的基础培训,但随着时间的推移,他们逐渐形成了自己的策略。经过一些经验积累,他们可以在 40 分钟内对满满一推车的 150 本书进行分类。而这种经验很大一部分在于了解将要发生的事情。
A similar knowledge of the material is useful to human sorters too. To see sorting experts in action, we took a field trip to UC Berkeley’s Doe and Moffitt Libraries, where there are no less than fifty-two miles of bookshelves to keep in order—and it’s all done by hand. Books returned to the library are first placed in a behind-the-scenes area, allocated to shelves designated by Library of Congress call numbers. For example, one set of shelves there contains a jumble of all the recently returned books with call numbers PS3000–PS9999. Then student assistants load those books onto carts, putting up to 150 books in proper order so they can be returned to the library shelves. The students get some basic training in sorting, but develop their own strategies over time. After a bit of experience, they can sort a full cart of 150 books in less than 40 minutes. And a big part of that experience involves knowing what to expect.
伯克利大学化学专业本科生乔丹·何 (Jordan Ho) 是一名星级分类员,他一边浏览 PS3000 至 PS9999 书架上一堆令人印象深刻的书籍,一边向我们讲述了他的阅读过程:
Berkeley undergraduate Jordan Ho, a chemistry major and star sorter, talked us through his process as he went through an impressive pile of books on the PS3000–PS9999 shelves:
经验告诉我,3500 的书很多,所以我想找出所有低于 3500 的书,然后粗略地筛选出来。筛选完成后,我会对它们进行更细致的排序。筛选出 3500 以下的书之后,我知道 3500 本身就是一个大类——3500 到 3599——所以我想把这部分单独列成一个类。如果这类书很多,我可能需要进一步细化:3510 的书、3520 的书、3530 的书。
I know from experience that there’s a lot of 3500s, so I want to look for any books that are below 3500 and rough-sort those out. And once I do that, then I sort those more finely. After I sort the ones under 3500, I know 3500 itself is a big section—3500–3599—so I want to make that a section itself. If there are a lot of those I might want to fine-tune it even more: 3510s, 3520s, 3530s.
乔丹的目标是将大约25本书放入购物车,然后按最终顺序排列,他使用了插入排序。而他精心设计的策略正是实现这一目标的正确方法:桶排序。他根据各种图书编号,对最终会有多少本书进行了充分的预测,从而确定了应该将哪些书放入哪个桶中。
Jordan aims to get a group of 25 or so books onto his cart before putting them in final order, which he does using an Insertion Sort. And his carefully developed strategy is exactly the right way to get there: a Bucket Sort, with his well-informed forecast of how many books he’ll have with various call numbers telling him what his buckets should be.
排序是预防搜索
Sort Is Prophylaxis for Search
了解所有这些排序算法,下次你决定按字母顺序排列书架时应该会很有帮助。就像奥巴马总统一样,你应该知道不要使用冒泡排序。一个好的策略——无论是人类还是机器图书管理员都认可的——是先进行桶排序,直到书堆足够小,以至于插入排序是合理的,或者举办一个归并排序披萨派对。
Knowing all these sorting algorithms should come in handy next time you decide to alphabetize your bookshelf. Like President Obama, you’ll know not to use Bubble Sort. Instead, a good strategy—ratified by human and machine librarians alike—is to Bucket Sort until you get down to small enough piles that Insertion Sort is reasonable, or to have a Mergesort pizza party.
但如果你真的请计算机科学家来帮助实现这个过程,他们会问的第一个问题是你是否应该进行排序。
But if you actually asked a computer scientist to help implement this process, the first question they would ask is whether you should be sorting at all.
正如本科生所学,计算机科学的核心在于权衡。我们已经在“观察”与“跳跃”、“探索”与“利用”之间的矛盾中看到了这一点。其中最核心的权衡之一就是排序与搜索之间的权衡。其基本原则是:排序所花费的精力,只是对后续搜索所花费精力的先发制人式打击。确切的平衡点应该取决于具体情况的具体参数,但认为排序的价值仅仅在于支持未来的搜索,这让我们得出了一个令人惊讶的结论:
Computer science, as undergraduates are taught, is all about tradeoffs. We’ve already seen this in the tensions between looking and leaping, between exploring and exploiting. And one of the most central tradeoffs is between sorting and searching. The basic principle is this: the effort expended on sorting materials is just a preemptive strike against the effort it’ll take to search through them later. What the precise balance should be depends on the exact parameters of the situation, but thinking about sorting as valuable only to support future search tells us something surprising:
宁可混乱。
Err on the side of messiness.
对那些你永远不会搜索的东西进行排序是一种完全的浪费;搜索那些你从未排序过的东西只是效率低下。
Sorting something that you will never search is a complete waste; searching something you never sorted is merely inefficient.
当然,问题变成了如何提前估计你未来的使用情况。
The question, of course, becomes how to estimate ahead of time what your future usage will be.
体现排序优势的典型代表当属谷歌这样的互联网搜索引擎。想想看,谷歌竟然能在不到半秒的时间内,根据你输入的搜索词组,搜索整个互联网,这听起来不可思议。好吧,它做不到——但它也不需要这么做。如果你是谷歌,你几乎可以肯定:(a) 你的数据会被搜索;(b) 你的数据不仅会被搜索一次,还会被反复搜索;(c) 排序所需的时间不知何故比搜索所需的时间“更不值钱”。(在这里,排序是由机器提前完成的,在需要结果之前;而搜索是由时间至关重要的用户完成的。)所有这些因素都表明,大量的前期排序是谷歌及其同类搜索引擎所做的事情。
The poster child for the advantages of sorting would be an Internet search engine like Google. It seems staggering to think that Google can take the search phrase you typed in and scour the entire Internet for it in less than half a second. Well, it can’t—but it doesn’t need to. If you’re Google, you are almost certain that (a) your data will be searched, (b) it will be searched not just once but repeatedly, and (c) the time needed to sort is somehow “less valuable” than the time needed to search. (Here, sorting is done by machines ahead of time, before the results are needed, and searching is done by users for whom time is of the essence.) All of these factors point in favor of tremendous up-front sorting, which is indeed what Google and its fellow search engines do.
那么,你应该按照字母顺序排列书架吗?对于大多数家用书架来说,几乎没有任何使分类变得有价值的条件。我们很少会搜索某本书。未分类搜索的成本相当低:对于每本书,如果我们知道它的大概位置,我们就能很快找到它。在分类的书架上找到这本书需要两秒钟,而在未分类的书架上查找则需要十秒钟,这之间的差别几乎不会造成什么影响。我们很少需要如此紧急地找到一本书,以至于值得预先花费数小时的准备时间,以节省以后的几秒钟。更重要的是,我们用敏锐的眼睛搜索,用缓慢的手分类。
So, should you alphabetize your bookshelves? For most domestic bookshelves, almost none of the conditions that make sorting worthwhile are true. It’s fairly rare that we find ourselves searching for a particular title. The costs of an unsorted search are pretty low: for every book, if we know roughly where it is we can put our hands on it quickly. And the difference between the two seconds it would take to find the book on a sorted shelf and the ten seconds it would take to scan for it on an unsorted one is hardly a deal breaker. We rarely need to find a title so urgently that it’s worth spending preparatory hours up front to shave off seconds later on. What’s more, we search with our quick eyes and sort with slow hands.
结论很明确:整理书架比浏览书架要花费更多的时间和精力。
The verdict is clear: ordering your bookshelf will take more time and energy than scanning through it ever will.
你杂乱无章的书架或许并非你每天的关注点,但你的电子邮件收件箱却几乎是——而且在电子邮件收件箱中,搜索比分类更轻松。手动将电子邮件归档到文件夹中所花的时间与现实世界中归档纸质文件的时间大致相同,但电子邮件的搜索效率远高于纸质文件。随着搜索成本的下降,分类的价值也随之降低。
Your unsorted bookshelf might not be an everyday preoccupation, but your email inbox almost certainly is—and it’s another domain where searching beats sorting handily. Filing electronic messages by hand into folders takes about the same amount of time as filing physical papers in the real world, but emails can be searched much more efficiently than their physical counterparts. As the cost of searching drops, sorting becomes less valuable.
史蒂夫·惠特克 (Steve Whittaker) 是研究人们如何处理电子邮件的全球专家之一。作为 IBM 的研究科学家和加州大学圣克鲁兹分校的教授,惠特克近二十年来一直在研究人们如何管理个人信息。(早在 1996 年,许多人甚至还没有电子邮件,他就发表了一篇关于“电子邮件过载”的论文。)2011 年,惠特克领导了一项关于电子邮件用户搜索和排序习惯的研究,发表了一篇题为《我是否在浪费时间整理电子邮件?》的论文。剧透预警:结论是肯定的。 “这是实证研究,但也是经验之谈,”惠特克指出。“当我采访人们关于这类组织问题时,他们通常会谈论的是,他们在某种程度上浪费了人生的一部分。”
Steve Whittaker is one of the world’s experts on how people handle their email. A research scientist at IBM and professor at UC Santa Cruz, Whittaker, for almost two decades, has been studying how people manage personal information. (He wrote a paper on “email overload” in 1996, before many people even had email.) In 2011, Whittaker led a study of the searching and sorting habits of email users, resulting in a paper titled “Am I Wasting My Time Organizing Email?” Spoiler alert: the conclusion was an emphatic Yes. “It’s empirical, but it’s also experiential,” Whittaker points out. “When I interview people about these kinds of organizational problems, that’s something that they characteristically talk about, is that they sort of wasted a part of their life.”
计算机科学表明,混乱和有序的危害都是可以量化的,而且它们的成本可以用同一种货币来衡量:时间。留下一些未整理的事情可能会被认为是一种拖延行为——把责任推卸给未来的自己,而未来的自己必须连本带利地偿还我们当初选择不支付的那些东西。但整个故事远比这更微妙。有时,混乱不仅仅是一种简单的选择,它还是一种最优的选择。
Computer science shows that the hazards of mess and the hazards of order are quantifiable and that their costs can be measured in the same currency: time. Leaving something unsorted might be thought of as an act of procrastination—passing the buck to one’s future self, who’ll have to pay off with interest what we chose not to pay up front. But the whole story is subtler than that. Sometimes mess is more than just the easy choice. It’s the optimal choice.
种类和运动
Sorts and Sports
搜索与排序的权衡表明,留下一堆杂物往往更有效率。不过,节省时间并非我们整理物品的唯一原因:有时,整理好最终的顺序本身就是目的。这一点在运动场上体现得最为明显。
The search-sort tradeoff suggests that it’s often more efficient to leave a mess. Saving time isn’t the only reason we sort things, though: sometimes producing a final order is an end in itself. And nowhere is that clearer than on the sporting field.
1883年,查尔斯·路特维奇·道奇森(Charles Lutwidge Dodgson)对英国草地网球的现状产生了极其强烈的感受。他解释道:
In 1883, Charles Lutwidge Dodgson developed incredibly strong feelings about the state of British lawn tennis. As he explains:
不久前,我偶然在一场草地网球锦标赛上观看了比赛,当时我听到一位选手的哀叹,这才意识到目前的评奖方式。这位选手在比赛初期就被击败了(因此失去了所有获奖的机会),他非常羞愧地看到二等奖被一位他知道水平远不如自己的选手夺走。
At a Lawn Tennis Tournament, where I chanced, some while ago, to be a spectator, the present method of assigning prizes was brought to my notice by the lamentations of one of the Players, who had been beaten (and had thus lost all chance of a prize) early in the contest, and who had had the mortification of seeing the 2nd prize carried off by a Player whom he knew to be quite inferior to himself.
普通观众或许会把这种“哀叹”归咎于失败带来的痛苦,但道奇森却并非普通的同情倾听者。他是牛津大学的数学讲师,运动员的抱怨促使他对体育赛事的本质进行了深入探究。
Normal spectators might chalk up such “lamentations” to little more than the sting of defeat, but Dodgson was no ordinary sympathetic ear. He was an Oxford lecturer in mathematics, and the sportsman’s complaints sent him on a deep investigation of the nature of sports tournaments.
道奇森不仅仅是一位牛津数学家——事实上,几乎没有人记得他曾是数学家。如今,他以笔名刘易斯·卡罗尔最为人熟知,并用这个笔名创作了《爱丽丝梦游仙境》以及许多其他深受喜爱的十九世纪文学作品。道奇森融合了他的数学和文学天赋,创作了一部鲜为人知的作品:《草地网球锦标赛:奖品分配的正确方法及其对现有方法谬误的证明》。
Dodgson was more than just an Oxford mathematician—in fact, he’s barely remembered as having been one. Today he’s best known by his pen name, Lewis Carroll, under which he wrote Alice’s Adventures in Wonderland and many other beloved works of nineteenth-century literature. Fusing his mathematical and literary talents, Dodgson produced one of his lesser-known works: “Lawn Tennis Tournaments: The True Method of Assigning Prizes with a Proof of the Fallacy of the Present Method.”
道奇森的抱怨针对的是单败淘汰赛的赛制。在这种赛制下,选手们会互相配对,只要输掉一场比赛就会被淘汰出局。正如道奇森有力地论证的那样,真正的第二名选手可能是被最优秀选手淘汰的任何一位,而不仅仅是最后被淘汰的选手。讽刺的是,奥运会确实有铜牌争夺赛,这似乎也表明我们承认单败淘汰赛制无法提供足够的信息来确定第三名。*但事实上,这种赛制也无法提供足够的信息来确定第二名——或者说,除了冠军之外,其他任何信息都无法确定。正如道奇森所说:“目前的评奖方式,除了一等奖之外,完全没有意义。” 坦白地说,银牌就是个谎言。
Dodgson’s complaint was directed at the structure of the Single Elimination tournament, where players are paired off with one another and eliminated from competition as soon as they lose a single match. As Dodgson forcefully argued, the true second-best player could be any of the players eliminated by the best—not just the last-eliminated one. Ironically, in the Olympics we do hold bronze medal matches, by which we appear to acknowledge that the Single Elimination format doesn’t give us enough information to determine third place.* But in fact this format doesn’t tell us enough to determine second place either—or, indeed, anything except the winner. As Dodgson put it, “The present method of assigning prizes is, except in the case of the first prize, entirely unmeaning.” Said plainly, the silver medal is a lie.
“从数学角度来说,”他继续说道,“第二名玩家获得应得奖品的概率只有 16/31;而前四名玩家获得应得奖品的概率非常小,概率是 12 比 1!”
“As a mathematical fact,” he continued, “the chance that the 2nd best Player will get the prize he deserves is only 16/31sts; while the chance that the best 4 shall get their proper prizes is so small, that the odds are 12 to 1 against its happening!”
尽管道奇森文笔流畅,但他对草地网球界的影响却微乎其微。他提出的解决方案,对三淘汰赛进行了笨拙的改编,即击败你的人也会淘汰你,这种方案从未流行起来。尽管道奇森的解决方案繁琐,但他对这个问题的批评却恰如其分。(唉,直到今天,单淘汰赛仍然有银牌颁发。)
Despite the powers of his pen, it appears that Dodgson had little impact on the world of lawn tennis. His solution, an awkward take on triple elimination where the defeat of someone who had defeated you could also eliminate you, never caught on. But if Dodgson’s solution was cumbersome, his critique of the problem was nevertheless spot on. (Alas, silver medals are still being handed out in Single Elimination tournaments to this day.)
但道奇森的逻辑中还有更深层次的洞见。我们人类整理的不仅仅是我们的数据,不仅仅是我们的财产。我们整理的是我们自己。
But there’s also a deeper insight in Dodgson’s logic. We humans sort more than our data, more than our possessions. We sort ourselves.
世界杯、奥运会、NCAA、NFL、NHL、NBA 和 MLB——所有这些赛事都隐含地实现了排序程序。它们的赛季、积分榜和季后赛都是生成排名顺序的算法。
The World Cup, the Olympics, the NCAA, NFL, NHL, NBA, and MLB—all of these implicitly implement sorting procedures. Their seasons, ladders, and playoffs are algorithms for producing rank order.
体育界最熟悉的算法之一是循环赛制,其中n支球队最终都会与其他n -1 支球队进行比赛。虽然它可以说是最全面的算法,但也是最费力的算法之一。让每支球队都与其他所有球队较量,就像在晚宴上邀请宾客拥抱一样:令人畏惧的O ( n² ),即二次方时间复杂度。
One of the most familiar algorithms in sports is the Round-Robin format, where each of n teams eventually plays every one of the other n − 1 teams. While arguably the most comprehensive, it’s also one of the most laborious. Having every team grapple with every other team is like having guests exchange hugs at our dinner party: the dreaded O(n2), quadratic time.
阶梯锦标赛——在羽毛球、壁球和短网拍墙球等运动中很受欢迎——将选手按线性排名排列,每位选手都可以直接向其上方的选手发起挑战,如果获胜,则交换排名。阶梯锦标赛是体育界的“冒泡排序”,因此也是二次的,需要O ( n² )场游戏才能达到稳定的排名。
Ladder tournaments—popular in sports like badminton, squash, and racquetball—put players in a linear ranking, with each player allowed to issue a direct challenge to the player immediately above them, exchanging places if they prevail. Ladders are the Bubble Sorts of the athletic world and are thus also quadratic, requiring O(n2) games to reach a stable ranking.
然而,最流行的锦标赛赛制或许是分组锦标赛——例如著名的NCAA篮球赛“疯狂三月”等。“疯狂三月”锦标赛的赛制从“64强赛”和“32强赛”开始,依次进入“甜蜜16强”、“精英八强”、“四强”和总决赛。每一轮比赛都将参赛队伍分成两半:这听起来是不是像对数函数?这些锦标赛实际上就像归并排序,从未排序的球队组合开始,然后不断地整理它们。
Perhaps the most prevalent tournament format, however, is a bracket tournament—as in the famous NCAA basketball “March Madness,” among many others. The March Madness tournament progresses from the “Round of 64” and the “Round of 32” to the “Sweet 16,” “Elite Eight,” “Final Four,” and the finals. Each round divides the field in half: does that sound familiarly logarithmic? These tournaments are effectively Mergesort, beginning with unsorted pairs of teams and collating, collating, collating them.
我们知道归并排序的运算时间复杂度是线性对数——O ( nlogn ) ——因此,假设有64支球队,我们预计只需要6轮(192场比赛),而不是像梯级赛或循环赛那样需要63轮(2016场比赛)。这是一个巨大的进步:算法设计在发挥作用。
We know that Mergesort operates in linearithmic time—O(n log n)—and so, given that there are 64 teams, we can expect to only need something like 6 rounds (192 games), rather than the whopping 63 rounds (2,016 games) it would take to do a ladder or Round-Robin. That’s a huge improvement: algorithm design at work.
六轮疯狂三月听起来还不错,但等一下:192场比赛?NCAA锦标赛只有63场。
Six rounds of March Madness sounds about right, but wait a second: 192 games? The NCAA tournament is only 63 games long.
事实上,疯狂三月并不是一个完整的归并排序——它没有对所有 64 支球队进行完整的排序。为了真正对球队进行排名,我们需要一组额外的比赛来确定第二名,另一组比赛来确定第三名,依此类推——总和需要线性对数数量的比赛。但疯狂三月并没有这样做。相反,就像道奇森抱怨的草地网球锦标赛一样,它采用了单淘汰赛制,被淘汰的球队没有排序。这样做的好处是它以线性时间运行:因为每场比赛只淘汰一支球队,所以为了让一支球队留下来,你只需要n -1 场比赛——一个线性数。缺点是,你永远无法真正弄清楚除了第一名之外的排名。
In fact, March Madness is not a complete Mergesort—it doesn’t produce a full ordering of all 64 teams. To truly rank the teams, we’d need an extra set of games to determine second place, another for third, and so on—taking a linearithmic number of games in sum. But March Madness doesn’t do that. Instead, just like the lawn tennis tournament that Dodgson complained about, it uses a Single Elimination format where the eliminated teams are left unsorted. The advantage is that it runs in linear time: since every game eliminates exactly one team, in order to have one team left standing you need just n − 1 games—a linear number. The disadvantage is that, well, you never really figure out the standings aside from first place.
讽刺的是,单淘汰赛实际上根本不需要任何锦标赛结构。任何63场比赛都会产生一位不败的冠军。例如,你可以让一支“山丘之王”队伍逐一挑战挑战者,直到被淘汰,然后击败它的队伍接替其位置继续比赛。然而,这种赛制的缺点是需要63轮独立比赛,因为比赛无法同时进行;此外,一支队伍可能需要连续打多达63场比赛,从疲劳的角度来看,这可能并不理想。
Ironically, in Single Elimination no tournament structure is actually necessary at all. Any 63 games will yield a single undefeated champion. For instance, you could simply have a single “king of the hill” team take on challengers one by one until it is dethroned, at which point whoever defeated it takes over its spot and continues. This format would have the drawback of needing 63 separate rounds, however, as games couldn’t happen in parallel; also, one team could potentially have to play as many as 63 games in a row, which might not be ideal from a fatigue standpoint.
尽管迈克尔·特里克比道奇森晚出生一个多世纪,但或许没有人能像他一样,将道奇森对体育的数学理解如此有力地传承到21世纪。我们之前在讨论最佳停赛时就曾见过特里克,但自从他把37%规则拙劣地运用到爱情生活中之后,几十年来,他不仅是一位丈夫和运筹学教授,现在还是美国职业棒球大联盟以及NCAA(如十大联盟和ACC)的主要赛程安排员之一,运用计算机科学来决定年度比赛的对阵。
Though born well over a century after Dodgson, perhaps no one carries forward his mathematical take on sporting into the twenty-first century as strongly as Michael Trick. We met Trick back in our discussion of optimal stopping, but in the decades since his hapless application of the 37% Rule to his love life he’s become not only a husband and a professor of operations research—he’s now also one of the principal schedulers for Major League Baseball and for NCAA conferences like the Big Ten and the ACC, using computer science to decide the year’s matchups.
正如特里克指出的那样,体育联盟并不关心如何尽快确定排名。相反,体育赛事日程的设计明确地是为了在整个赛季中保持紧张气氛,而这很少成为排序理论关注的重点。
As Trick points out, sports leagues aren’t concerned with determining the rankings as quickly and expeditiously as possible. Instead, sports calendars are explicitly designed to maintain tension throughout the season, something that has rarely been a concern of sorting theory.
例如,在美国职业棒球大联盟(MLB)中,经常会有分区冠军争夺战。如果我们忽略分区赛的设置,一些分区冠军争夺战可能会在赛季初期就尘埃落定。但我们的做法是,确保在最后五周,所有球队都要与各自分区内的其他球队进行比赛。这样做的目的是,无论谁参加分区冠军争夺战都无关紧要:他们必须在赛季最后五周至少与排名第二的对手进行六场比赛。这样一来,赛程安排和赛季本身就更受关注,因为在这种情况下,不确定性的解决会被推迟。
For instance in Major League Baseball, you often have races to see who is going to win the division. Now, if we ignored the divisional setup, some of those races might get resolved fairly early in the season. But instead what we do is we make certain in the last five weeks, everybody plays everybody else within their division. The purpose of that is it doesn’t matter who’s in a divisional race: they’re going to have to play their next closest opponent at least six games in the final five weeks of the season. That allows for more interest in the schedule or interest in the season because in this case, uncertainty is delayed in its resolution.
当然,体育运动并非总是严格地以最小化比赛场次为设计目标。如果不记住这一点,体育赛事安排的某些方面对计算机科学家来说就会显得神秘莫测。正如特里克在谈到棒球常规赛的2430场比赛时所说:“我们知道n log n是进行完整排序的正确比较次数。这样可以得到所有。如果他们只关心排名,为什么还要进行n 2 的比较才能在某种意义上得到排名靠前的 呢?”换句话说,如果我们知道可以在线性对数时间内完成完整排序,并且可以在少于n场比赛的时间内赢得不败的单败淘汰赛冠军,为什么还要进行完整的O ( n 2 ) 循环赛甚至更多呢?嗯,最小化比赛场次实际上并不符合联盟的利益。在计算机科学中,不必要的比较总是不好的,浪费时间和精力。但在体育运动中,情况远非如此。毕竟,在很多方面,比赛本身才是重点。
What’s more, sports are not, of course, always designed strictly to minimize the number of games. Without remembering this, some aspects of sports scheduling would otherwise seem mysterious to a computer scientist. As Trick says of baseball’s regular season of 2,430 games, “We know that n log n is the right number of comparisons to do a full sort. That can get you everybody. Why do they do n2 in order to just get, in some sense, the top, if that’s all they care about?” In other words, why do a full O(n2) Round-Robin and then some, if we know we can do a full sort in linearithmic time, and can crown an undefeated Single Elimination champion in less than n games? Well, minimizing the number of games isn’t actually in the league’s interest. In computer science unnecessary comparisons are always bad, a waste of time and effort. But in sports that’s far from the case. In many respects, after all, the games themselves are the point.
抱怨的权利:噪音和稳健性
Griping Rights: Noise and Robustness
训练体育运动算法镜头的另一种或许更为重要的方法是,不要问我们应该对银牌有多大信心,而是要问我们应该对金牌有多大信心。
Another, perhaps even more important way of training an algorithmic lens on sports is to ask not what confidence we should have in the silver medal, but what confidence we should have in the gold.
正如迈克尔·特里克所解释的那样,在某些运动项目中,“比如棒球,一支球队几乎无论谁赢,都会输掉30%的比赛,而另一支球队几乎都会赢30%的比赛。” 这对单败淘汰赛制有着令人不安的影响。假设NCAA篮球赛中,实力较强的球队胜率高达70%,而赢得锦标赛需要连续6场比赛获胜,那么最好的球队赢得锦标赛的概率只有0.70的6次方——不到12%!换句话说,锦标赛每十年才能最终决出联盟真正的最佳球队。
As Michael Trick explains, in some sports, “for instance baseball, a team is going to lose 30% of their games and a team is going to win 30% of their games practically no matter who they are.” This has disturbing implications for the Single Elimination format. If NCAA basketball games, say, are won by the stronger team 70% of the time, and winning the tournament involves prevailing in 6 straight games, then the best team has only a 0.70 to the 6th power—less than 12%—chance of winning the tournament! Put another way, the tournament would crown the league’s truly best team just once a decade.
在某些体育项目中,即使对比赛结果有70%的把握,也可能显得过于相信最终比分。加州大学圣地亚哥分校的物理学家汤姆·墨菲将数值建模技术应用于足球比赛,并得出结论:足球比赛的低比分使得比赛结果比大多数球迷想象的更接近随机性。“3:2的比分,让获胜球队真正成为一支更强大的球队的概率只有五分之八……我个人觉得这并不算什么。即使是6:1的大胜,也有7%的可能性是统计上的侥幸。”
It may be that in some sports, having even 70% confidence in a game’s outcome might be putting too much stock in the final score. UCSD physicist Tom Murphy applied numerical modeling techniques to soccer and concluded that soccer’s low scores make game outcomes much closer to random than most fans would prefer to imagine. “A 3:2 score gives the winning team only a 5-in-8 chance of actually being a better team … Personally, I don’t find this to be very impressive. Even a 6:1 blowout leaves a 7% chance that it was a statistical fluke.”
计算机科学家将这种现象称为噪声。迄今为止,我们讨论过的所有排序算法都假设比较过程完美无瑕、万无一失,不会出错,也不会错误地将两个量中较小的一个判断为较大的一个。一旦允许“噪声比较器”的存在,计算机科学中一些最神圣的算法就会失效,而一些最受诟病的算法也会迎来救赎之日。
Computer scientists call this phenomenon noise. All of the sorting algorithms that we’ve considered thus far assume perfect, flawless, foolproof comparisons, ones that never mess up and mistakenly judge the lesser of two quantities to be the greater. Once you allow for a “noisy comparator,” some of computer science’s most hallowed algorithms go out the window—and some of its most maligned have their day of redemption.
新墨西哥大学计算机科学教授戴夫·阿克利(Dave Ackley)致力于研究计算机科学与“人工生命”的交叉领域——他认为计算机能够从生物学中学习一些东西。首先,在生物体生存的世界中,很少有过程能够达到计算机所依赖的可靠性水平,因此它们从一开始就被设计为研究人员所称的“鲁棒性”。阿克利认为,现在是时候让我们也开始认识到算法鲁棒性的优点了。
Dave Ackley, professor of computer science at the University of New Mexico, works at the intersection of computer science and “artificial life”—he believes computers can stand to learn a few things from biology. For starters, organisms live in a world where few processes have anywhere near the level of reliability that computers depend on, so they are built from the ground up for what researchers call robustness. It’s time, argues Ackley, that we started recognizing the virtues of robustness in algorithms too.
因此,尽管权威编程巨著《排序与搜索》大胆宣称“冒泡排序毫无可取之处”,但阿克利及其同事的研究表明,像冒泡排序这样的算法或许仍有其用武之地。它效率极低——每次只将元素移动一个位置——这使得它对噪声具有相当强的鲁棒性,远胜于像归并排序这样速度更快的算法,因为在归并排序中,每次比较都可能将元素移动很长一段距离。归并排序的高效性也使其变得脆弱。归并排序中的早期失误就像在单败淘汰赛第一轮中意外失利,这不仅会粉碎一支热门球队的夺冠希望,还会让他们永远地降级到排名的后半段。*另一方面,在阶梯锦标赛中,就像在冒泡排序中一样,一次意外的失利只会让选手在积分榜上下降一位。
Thus, while the authoritative programming tome Sorting and Searching boldly declares that “bubble sort has no apparent redeeming features,” the research of Ackley and his collaborators suggests that there may be a place for algorithms like Bubble Sort after all. Its very inefficiency—moving items only one position at a time—makes it fairly robust against noise, far more robust than faster algorithms like Mergesort, in which each comparison potentially moves an item a long way. Mergesort’s very efficiency makes it brittle. An early error in a Mergesort is like a fluke loss in the first round of a Single Elimination tournament, which can not only dash a favored team’s championship hopes but also permanently relegate them to the bottom half of the results.* In a Ladder tournament, on the other hand, as in a Bubble Sort, a fluke loss would only set a player back a single place in the standings.
但事实上,面对嘈杂的比较器,冒泡排序并非最佳算法。赢得这一殊荣的是一种名为“比较计数排序”的算法。在该算法中,每个元素都会与所有其他元素进行比较,并计算出它比其他元素大的元素数。这个数字可以直接用作该元素的排名。由于比较计数排序会比较所有元素对,因此它与冒泡排序一样,是一种二次时间算法。因此,它在传统计算机科学应用中并不流行,但它具有极强的容错能力。
But in fact it isn’t Bubble Sort that emerges as the single best algorithm in the face of a noisy comparator. The winner of that particular honor is an algorithm called Comparison Counting Sort. In this algorithm, each item is compared to all the others, generating a tally of how many items it is bigger than. This number can then be used directly as the item’s rank. Since it compares all pairs, Comparison Counting Sort is a quadratic-time algorithm, like Bubble Sort. Thus it’s not a popular choice in traditional computer science applications, but it’s exceptionally fault-tolerant.
这个算法的工作原理听起来应该很熟悉。比较计数排序的运作方式与循环赛完全相同。换句话说,它非常类似于一支运动队的常规赛——与同赛区的其他所有球队比赛,并根据胜负记录进行排名。
This algorithm’s workings should sound familiar. Comparison Counting Sort operates exactly like a Round-Robin tournament. In other words, it strongly resembles a sports team’s regular season—playing every other team in the division and building up a win-loss record by which they are ranked.
比较计数排序是目前已知的最稳健的排序算法,无论是二次排序还是更高级的算法,它应该能为体育迷们提供一些非常特别的启示:如果你的球队没能进入季后赛,别抱怨。归并排序的季后赛充满不确定性,但比较计数的常规赛却并非如此;总冠军戒指的稳定性并不高,但分区排名的稳定性却无可挑剔。换句话说,如果你的球队在季后赛早早出局,那只能说运气不好。但如果你的球队最终没能进入季后赛,那这就是残酷的现实。你可能会在体育酒吧里得到其他失望球迷的同情,但你绝对不会从计算机科学家那里得到任何同情。
That Comparison Counting Sort is the single most robust sorting algorithm known, quadratic or better, should offer something very specific to sports fans: if your team doesn’t make the playoffs, don’t whine. The Mergesort postseason is chancy, but the Comparison Counting regular season is not; championship rings aren’t robust, but divisional standings are literally as robust as it gets. Put differently, if your team is eliminated early in the postseason, it’s tough luck. But if your team fails to get to the postseason, it’s tough truth. You may get sports-bar sympathy from your fellow disappointed fans, but you won’t get any from a computer scientist.
血统排序:啄食顺序和支配等级
Blood Sort: Pecking Orders and Dominance Hierarchies
到目前为止,我们讨论的所有例子中,排序过程都是自上而下强制执行的:图书管理员负责整理书籍,NCAA 负责决定球队与哪支球队比赛以及何时比赛。但如果这种面对面的比较完全是自愿的呢?当排序过程自下而上地自然形成时,它会是什么样子?
In all the examples we’ve considered so far, the sorting process in every case has been imposed from the top down: a librarian shelving books, the NCAA telling teams whom to play and when. But what if head-to-head comparisons happened only voluntarily? What does sorting look like when it emerges organically, from the bottom up?
它可能看起来有点像在线扑克。
It might look something like online poker.
与大多数受某种管理机构管辖的体育项目不同,扑克游戏尽管在过去十年中人气飙升,却依然保持着某种程度的无政府状态。虽然一些备受瞩目的锦标赛确实明确地对参赛者进行分类(并相应地支付报酬),但相当一部分扑克游戏仍然以所谓的“现金游戏”形式进行,即两名或两名以上玩家自发同意在每手牌上投入真钱。
Unlike most sports, which are governed by a ruling body of some kind, poker remains somewhat anarchic despite exploding in popularity over the past decade. Though some high-profile tournaments do explicitly sort their contestants (and remunerate them accordingly), a substantial portion of poker is still played in what are known as “cash games,” where two or more players spontaneously agree to play with real money on the line with every hand.
几乎没人比艾萨克·哈克斯顿(Isaac Haxton)更了解这个世界,他是世界上最优秀的现金扑克玩家之一。在大多数体育运动中,只要尽可能地优秀就足够了,而且对自己的技术越不自觉越好。但是,哈克斯顿解释说:“从某种程度上来说,作为一名职业扑克玩家,最重要的技能是能够评估自己的水平。如果你还不是世界上最优秀的扑克玩家,并且总是愿意和比你更厉害的人比赛,那么你几乎肯定会破产。”
Virtually no one knows this world more deeply than Isaac Haxton, one of the world’s best cash-game poker players. In most sports it’s sufficient to be as good as possible, and the less self-conscious one is about one’s skills the better. But, Haxton explains, “In some ways the most important skill as a professional poker player is to be able to evaluate how good you are. If you’re anything short of the very best poker player in the world, you can be pretty much assured of going broke if you are endlessly willing to play people better than you.”
哈克斯顿是一位单挑、无限注的专家:“单挑”指的是一对一的扑克比赛,“无限注”则指最高赌注,仅受玩家资金和承受能力的限制。在多人扑克现金游戏中,通常会有一名实力较弱的玩家——例如一位富有的业余玩家——来对付一桌职业玩家,而这些职业玩家并不太在意谁更胜一筹。但在单挑的世界里,情况就不同了。“你和他们之间必须存在关于谁更胜一筹的分歧——或者必须有人心甘情愿地输掉比赛。”
Haxton is a heads-up, no-limit specialist: “heads-up” meaning one-on-one poker, and “no-limit” meaning just that—the highest stakes, limited only by what they can bankroll and stomach. In multi-handed poker cash games, there will often be one weak player—a wealthy amateur, for instance—feeding a table full of professionals, who then don’t much care who among them is better than whom. In the world of heads-up, it’s different. “There has to be a disagreement between you and them about who’s better—or somebody has to be willingly losing.”
那么,如果大家已经达成共识,没有人愿意和比自己强的牌手比赛,会发生什么呢?结果会是玩家们争抢座位。大多数在线扑克网站提供的牌桌数量有限。“所以,如果你想玩盲注五十美元或一百美元的单挑无限注,只有十张牌桌可用,”哈克斯顿说,“所以只有目前在场的、公认的十位最佳玩家……只能坐着等着有人出现并想玩。” 如果有一位更优秀的玩家来到这些牌桌之一坐下呢?如果坐在那里的人不愿意下注,他们就会滚蛋。
So what happens when there’s a fairly established consensus and no one’s willing to play anyone better than they are? You get something that looks a lot like players simply jockeying for seats. Most online poker sites have only a finite number of tables available. “So if you want to play heads-up no-limit, with blinds of fifty and one hundred dollars, there are only ten available tables for that,” says Haxton, “and so only the consensus ten best players who are out right now … sit and wait for someone to show up who wants to play.” And if a superior player arrives and sits down at one of these tables? If the person sitting isn’t willing to ante up, they scram.
“想象一下两只猴子,”克里斯托夫·诺伊曼说道。“其中一只安静地坐在原地吃东西,另一只走到另一只猴子坐的地方。然后那只猴子就会站起来走开。”
“Imagine two monkeys,” says Christof Neumann. “One is sitting and feeding in its spot, very peacefully, and another one is coming up [to] where the other guy is sitting. And that guy would then stand up and leave.”
诺伊曼并非在用扑克牌做比喻。他是纳沙泰尔大学的行为生物学家,研究猕猴的支配地位。他刚才描述的现象被称为“置换”。
Neumann isn’t making a poker metaphor. He’s a behavioral biologist at the University of Neuchâtel who studies dominance in macaques. What he’s just described is known as displacement.
当动物利用其对等级制度的认知,认定某次冲突不值得时,就会发生置换。在许多动物社会中,资源和机会——食物、配偶、偏好的空间等等——都是稀缺的,必须以某种方式决定谁能得到什么。提前建立秩序,比每次遇到交配机会或最佳草场时就大打出手要温和得多。虽然我们可能会对动物用爪子和喙互相攻击感到畏缩,但生物学家倾向于认为啄食顺序是先发制人的暴力。
Displacement happens when an animal uses its knowledge of the hierarchy to determine that a particular confrontation simply isn’t worth it. In many animal societies, resources and opportunities—food, mates, preferred spaces, and so forth—are scarce, and somehow it must be decided who gets what. Establishing an order ahead of time is less violent than coming to blows every time a mating opportunity or a prime spot of grass becomes available. Though we may cringe when we see creatures turning their claws and beaks on each other, biologists tend to think of pecking orders as the violence that preempts violence.
听起来很熟悉?这就是搜索排序的权衡。
Sound familiar? It’s the search-sort tradeoff.
建立啄食顺序,实际上是用拳击式的方法来解决一个根本性的计算问题。顺便说一句,正因如此,农场里给鸡断喙的做法或许出于好意,但却适得其反:它剥夺了个体斗殴在解决啄食顺序方面的权威,从而使鸡群更难进行任何排序。因此,在很多情况下,鸡群内部的对抗程度实际上有所增加。
The creation of a pecking order is a pugilistic solution to a fundamentally computational problem. For this reason, incidentally, debeaking chickens on farms may be a well-intentioned but counterproductive approach: it removes the authority of individual fights to resolve the order, and therefore makes it much harder for the flock to run any sorting procedure at all. So the amount of antagonism within the flock in many cases actually increases.
从计算机科学的角度观察动物行为可以得出几个结论。首先,这意味着随着群体规模的扩大,每个个体遭遇敌对冲突的次数将大幅增长——至少是对数级,甚至可能是二次方级。事实上,对母鸡“攻击行为”的研究发现,“随着群体规模的扩大,每只母鸡的攻击行为也会增加”。因此,分类理论表明,合乎道德的牲畜饲养可能包括限制鸡群或牛群的规模。(在野外,野鸡通常以10到20只为一群体游荡,远小于商业农场的鸡群规模。)研究还表明,除非鸡群中加入新成员,否则攻击行为似乎会在几周后消失——这证实了群体正在自我分类的观点。
Looking at animal behavior from the perspective of computer science suggests several things. For one, it implies that the number of hostile confrontations encountered by each individual will grow substantially—at least logarithmically, and perhaps quadratically—as the group gets bigger. Indeed, studies of “agonistic behavior” in hens have found that “aggressive acts per hen increased as group size increased.” Sorting theory thus suggests that the ethical raising of livestock may include limiting the size of the flock or herd. (In the wild, feral chickens roam in groups of ten to twenty, far smaller than flock sizes on commercial farms.) The studies also show that aggression appears to go away after a period of some weeks, unless new members are added to the flock—corroborating the idea that the group is sorting itself.
威斯康星大学麦迪逊分校复杂性与集体计算中心联合主任杰西卡·弗莱克认为,思考自然界去中心化排序的关键在于,支配等级最终是信息等级。弗莱克指出,这些去中心化排序系统需要承担巨大的计算负担。比如,一群猕猴,只有在每只猴子都对等级制度有详细且相似的理解的情况下,才能最大限度地减少打斗的发生。否则,暴力事件就会随之而来。
The key to thinking about decentralized sorting in nature, argues Jessica Flack, codirector of the Center for Complexity and Collective Computation at UW–Madison, is that dominance hierarchies are ultimately information hierarchies. There’s a significant computational burden to these decentralized sorting systems, Flack points out. The number of fights in, say, a group of macaques is minimized only to the extent that every monkey has a detailed—and similar—understanding of the hierarchy. Otherwise violence will ensue.
如果归结于主角们对当前顺序的把握能力,那么随着动物推理和记忆能力的提升,我们或许会看到更少的冲突。或许人类确实最接近最高效的排序。正如哈克斯顿谈到扑克世界时所说:“我是世界上最顶尖的单挑无限注德州扑克玩家之一,我心中对我认为的二十多位最佳玩家有一个相当具体的排名,而且我认为他们每个人心中都有类似的排名。我认为大家对这份名单的具体内容有着相当高的共识。” 只有当这些排名不同时,才会出现现金游戏。
If it comes down to how good the protagonists are at keeping track of the current order, we might expect to see fewer confrontations as animals become better able to reason and remember. And perhaps humans do come closest to optimally efficient sorting. As Haxton says of the poker world, “I’m one of the top heads-up, no-limit hold ’em players in the world, and in my head I have a fairly specific ranking of who I think the twenty or so best players are, and I think each of them has a similar ranking in their mind. I think there is a pretty high degree of consensus about what the list looks like.” Only when these rankings differ will cash games ensue.
竞赛而非战斗
A Race Instead of a Fight
我们现在看到了任何群体渴望自我整理的两大弊端。你至少会面临线性数量的对抗,随着群体规模的扩大,每个人的生活都会变得更加充满战斗力——同时,你也迫使每个竞争者密切关注其他人不断变化的状态,否则他们会发现自己陷入了不必要的争斗。这不仅会消耗体力,还会消耗脑力。
We’ve now seen two separate downsides to the desire of any group to sort itself. You have, at minimum, a linearithmic number of confrontations, making everyone’s life more combative as the group grows—and you also oblige every competitor to keep track of the ever-shifting status of everyone else, otherwise they’ll find themselves fighting battles they didn’t need to. It taxes not only the body but the mind.
但其实不必如此。有很多方法可以不用花费成本来下订单。
But it doesn’t have to be that way. There are ways of making order without the costs.
例如,有一项体育竞赛,数万名参赛者在仅仅一场比赛的时间内就完成了排序。(而一万名参赛者的循环赛则需要一亿次对决。)唯一需要注意的是,这项赛事所需的时间是由速度最慢的参赛者决定的。这项体育竞赛就是马拉松,它表明了一个至关重要的事实:赛跑与打架有着根本的不同。
There’s one sporting contest, for instance, where tens of thousands of competitors are completely sorted within the time that it takes to hold just a single event. (A Round-Robin tournament with ten thousand players, on the other hand, would require a hundred million matchups.) The only caveat is that the time required for the event is determined by its slowest competitors. This sporting contest is the marathon, and it suggests something critical: a race is fundamentally different from a fight.
试想一下拳击手和滑雪运动员、击剑运动员和跑步运动员之间的区别。一名奥运会拳击手必须冒着脑震荡的风险O (log n ) 次,通常是 4 到 6 次,才能登上领奖台;允许更多运动员参赛将危及所有人的健康。但钢架雪车、跳台滑雪或半管滑雪运动员只需与重力进行常数次冒险,无论参赛队伍规模大小。击剑运动员要让自己受制于对手O (log n ) 次,但马拉松运动员只需坚持一场比赛。能够为表现分配一个简单的数值衡量标准,可以得到一个常数时间的状态算法。
Consider the difference between boxers and skiers, between fencers and runners. An Olympic boxer must risk concussion O(log n) times, usually from 4 to 6, to make it to the podium; allowing a greater number of athletes into the games would imperil the health of all. But a skeleton racer or ski jumper or halfpipe specialist needs to make only a constant number of gambles with gravity, no matter the size of the field. A fencer puts herself at her opponent’s mercy O(log n) times, but a marathoner must endure only one race. Being able to assign a simple numerical measure of performance results in a constant-time algorithm for status.
从“序数”(仅表示等级)到“基数”(直接将度量分配给某物的质量)的转变自然地对集合进行了排序,而无需成对比较。因此,它使不需要直接面对面较量的支配层次结构成为可能。财富500 强榜单就是其中之一,因为它创建了一种公司层次结构。为了找到美国最有价值的公司,分析师不需要进行尽职调查,将微软与通用汽车进行比较,然后将通用汽车与雪佛龙进行比较,将雪佛龙与沃尔玛进行比较等等。这些看似苹果与橘子的竞赛(多少企业软件安装等于多少石油期货?)以美元为媒介变成了苹果与苹果之间的比较。拥有基准 - 任何基准 - 都可以解决扩大排序的计算问题。
This move from “ordinal” numbers (which only express rank) to “cardinal” ones (which directly assign a measure to something’s caliber) naturally orders a set without requiring pairwise comparisons. Accordingly, it makes possible dominance hierarchies that don’t require direct head-to-head matchups. The Fortune 500 list, to the extent that it creates a kind of corporate hierarchy, is one of these. To find the most valuable company in the United States, analysts don’t need to perform due diligence comparing Microsoft to General Motors, then General Motors to Chevron, Chevron to Walmart, and so forth. These seemingly apples-to-oranges contests (how many enterprise software installations equal how many oil futures?) become apples-to-apples in the medium of dollars. Having a benchmark—any benchmark—solves the computational problem of scaling up a sort.
例如,在硅谷,有句关于会议的谚语:“你去找钱,钱不会来找你。”供应商去找创始人,创始人去找风险投资家,风险投资家去找他们的有限合伙人。个人可能会对这种等级制度的基础感到不满,但实际上不会对其裁决提出异议。因此,个人之间的互动很少发生争夺地位的情况。总的来说,任何一对人都可以在无需协商的情况下,判断谁应该对谁表现出何种程度的尊重。每个人都知道在哪里见面。
In Silicon Valley, for instance, there’s an adage about meetings: “You go to the money, the money doesn’t come to you.” Vendors go to founders, founders go to venture capitalists, venture capitalists go to their limited partners. It’s possible for the individuals to resent the basis of this hierarchy, but not really to contest its verdict. As a result, individual pairwise interactions take place with a minimum of jockeying for status. By and large, any pair of people can tell, without needing to negotiate, who is supposed to show what level of respect to whom. Everyone knows where to meet.
同样,虽然理论上海上通行权受一套极其复杂的公约管辖,但在实践中,一条简单的原则决定了哪艘船给哪艘船让路:“总吨位法则”。很简单,小船要给大船让路。有些动物也很幸运,拥有如此明确的统治等级。正如诺伊曼所观察到的:“比如鱼:体型较大的才是主导者。这很简单。” 正因为如此简单,鱼才更爱好和平。与鸡和灵长类动物不同,鱼不需要流血就能维持秩序。
Likewise, while maritime right-of-way is governed in theory by an extremely elaborate set of conventions, in practice one straightforward principle determines which ships give way to which: the “Law of Gross Tonnage.” Quite simply, the smaller ship gets out of the way of the larger one. Some animals are also lucky enough to have such clear-cut dominance hierarchies. As Neumann observes, “Look at fish, for example: the bigger one is the dominant one. It’s very simple.” And because it’s so simple, it’s peaceful. Unlike chickens and primates, fish make order without shedding blood.
当我们思考构成大规模人类社会的因素时,很容易将焦点集中在技术上:农业、金属、机械。但用量化指标衡量地位的文化实践或许也同样重要。当然,金钱不必成为衡量标准;例如,“尊老爱幼”这样的规则,同样可以通过一个共同的量来决定人们的地位。同样的原则也适用于国家之间和国家内部。人们常常注意到,像国家GDP这样的基准——它构成了G20等外交峰会邀请名单的基础——是一种粗略且不完善的衡量标准。但任何基准的存在,都会将国家地位问题从一个需要至少线性对数级的争斗和解决方案的问题,转变为一个只有一个参考点、可以对所有问题进行排序的问题。鉴于国与国之间的地位争端通常以军事形式出现,这不仅能节省时间,还能挽救生命。
When we think about the factors that make large-scale human societies possible, it’s easy to focus on technologies: agriculture, metals, machinery. But the cultural practice of measuring status with quantifiable metrics might be just as important. Money, of course, need not be the criterion; a rule like “respect your elders,” for instance, likewise settles questions of people’s status by reference to a common quantity. And the same principle is at work between nations as within them. It is often noted that a benchmark like national GDP—which underlies the invite lists to diplomatic summits such as the G20—is a crude, imperfect measurement. But the existence of any benchmark at all transforms the question of national status from one demanding at least a linearithmic number of tussles and resolutions into something with a single reference point that ranks all. Given that nation-to-nation status disputes often take military form, this saves not only time but lives.
对于小规模群体来说,线性对数数量的战斗或许效果良好;在自然界中确实如此。但在一个地位通过两两比较来确立的世界里——无论这些比较是言语交锋还是枪战——随着社会的发展,对抗的数量很快就会失控。在工业规模的运作中,成千上万的个体共享同一空间,这就需要跨越一个更大的界限。从序数到基数的跨越。
Linearithmic numbers of fights might work fine for small-scale groups; they do in nature. But in a world where status is established through pairwise comparisons—whether they involve exchanging rhetoric or gunfire—the amount of confrontation quickly spirals out of control as society grows. Operating at industrial scale, with many thousands or millions of individuals sharing the same space, requires a leap beyond. A leap from ordinal to cardinal.
尽管我们每天都在抱怨老鼠赛跑,但事实上,这是一场竞赛而不是一场战斗,这是我们与猴子、鸡,甚至老鼠区别开来的关键因素。
Much as we bemoan the daily rat race, the fact that it’s a race rather than a fight is a key part of what sets us apart from the monkeys, the chickens—and, for that matter, the rats.
*这远非布拉达奇的唯一记录——他可以在大致相同的时间内在水下摆脱三副手铐。
*This is far from Bradáč’s only record—he can escape from three pairs of handcuffs while underwater in roughly the same amount of time.
*实际上,冒泡排序的平均运行时间并没有缩短,因为书籍平均会偏离它们最终应该到达的位置n /2 个位置。计算机科学家仍然会将n 本书的n /2 次遍历舍入到O ( n² )的复杂度。
*Actually, the average running time for Bubble Sort isn’t any better, as books will, on average, be n/2 positions away from where they’re supposed to end up. A computer scientist will still round n/2 passes of n books up to O(n2).
*在极少数情况下,例如在拳击比赛中,如果拳击手在被击倒后再次比赛,从医学角度来看是不安全的,因此会颁发两枚铜牌。
*On rare occasions, as in boxing—where it is medically unsafe for a boxer to fight again after being recently knocked out—two bronzes are awarded instead.
*有趣的是,NCAA 的疯狂三月锦标赛在设计时特意考虑了算法中的这一缺陷。正如我们之前所说,单败淘汰赛最大的问题似乎是,第一个被冠军球队淘汰的球队实际上是总排名第二的球队,但却落入了(未排序的)下半区。NCAA 通过对球队进行种子排序来解决这个问题,这样排名靠前的球队就不会在早期轮次中相遇。这种种子排序机制似乎至少在最极端的情况下是可靠的,因为在疯狂三月的历史上,从未有一支 16 号种子球队击败过头号种子球队。
*It’s interesting to note that NCAA’s March Madness tournament is consciously designed to mitigate this flaw in its algorithm. The biggest problem in Single Elimination, as we’ve said, would seem to be a scenario where the first team that gets eliminated by the winning team is actually the second-best team overall, yet lands in the (unsorted) bottom half. The NCAA works around this by seeding the teams, so that top-ranked teams cannot meet each other in the early rounds. The seeding process appears to be reliable at least in the most extreme case, as a sixteenth-seeded team has never defeated a first seed in the history of March Madness.
在我们智力的实际运用中,遗忘与记忆同样重要。
In the practical use of our intellect, forgetting is as important a function as remembering.
—威廉·詹姆斯
—WILLIAM JAMES
你遇到了一个问题。你的衣柜里堆满了东西,鞋子、衬衫和内衣都散落在地板上。你想:“该整理一下了。” 现在你有两个问题了。
You have a problem. Your closet is overflowing, spilling shoes, shirts, and underwear onto the floor. You think, “It’s time to get organized.” Now you have two problems.
具体来说,你首先需要决定要保留什么,其次要决定如何安排。幸运的是,有一小部分人以思考这两个双重问题为生,他们非常乐意提供建议。
Specifically, you first need to decide what to keep, and second, how to arrange it. Fortunately, there is a small industry of people who think about these twin problems for a living, and they are more than happy to offer their advice.
关于要保留什么,玛莎·斯图尔特建议问自己几个问题:“我拥有它多久了?它还能用吗?它是我已经拥有的东西的复制品吗?我上次穿或用它是什么时候?”关于如何整理你要保留的物品,她建议“把类似的东西放在一起”,她的同行专家也同意这一建议。弗朗辛·杰伊在《少即是多》一书中建议:“把你所有的裙子挂在一起,裤子挂在一起,连衣裙挂在一起,外套挂在一起。”自称是“美国最有条理的人”的安德鲁·梅伦规定,“物品要按类型分类 - 所有休闲裤挂在一起,衬衫挂在一起,外套挂在一起,等等。在每种类型中,它们要按颜色和款式进一步分类 - 长袖或短袖,按领口分类,等等。”除了这可能带来的整理问题之外,这似乎是个好建议;似乎得到了一致的赞同。
On what to keep, Martha Stewart says to ask yourself a few questions: “How long have I had it? Does it still function? Is it a duplicate of something I already own? When was the last time I wore it or used it?” On how to organize what you keep, she recommends “grouping like things together,” and her fellow experts agree. Francine Jay, in The Joy of Less, stipulates, “Hang all your skirts together, pants together, dresses together, and coats together.” Andrew Mellen, who bills himself as “The Most Organized Man in America,” dictates, “Items will be sorted by type—all slacks together, shirts together, coats, etc. Within each type, they’re further sorted by color and style—long-sleeved or short-sleeved, by neckline, etc.” Other than the sorting problem this could entail, it looks like good advice; it certainly seems unanimous.
但实际上,还有另一个规模更大的专业人士行业,他们也对存储有着痴迷的思考,而且他们有自己的想法。
Except that there is another, larger industry of professionals who also think obsessively about storage—and they have their own ideas.
你的衣柜面临的挑战与计算机管理内存时面临的挑战大致相同:空间有限,目标是省钱又省时。自从计算机诞生以来,计算机科学家们就一直在努力解决“什么该保留”和“如何整理”这两个问题。数十年的努力成果表明,在玛莎·斯图尔特关于扔掉什么的四句话建议中,实际上提出了几条不同且并非完全兼容的建议——其中一条比其他几条更为关键。
Your closet presents much the same challenge that a computer faces when managing its memory: space is limited, and the goal is to save both money and time. For as long as there have been computers, computer scientists have grappled with the dual problems of what to keep and how to arrange it. The results of these decades of effort reveal that in her four-sentence advice about what to toss, Martha Stewart actually makes several different, and not fully compatible, recommendations—one of which is much more critical than the others.
内存管理的计算机科学也揭示了你的衣柜(以及你的办公室)应该如何摆放。乍一看,计算机似乎遵循了玛莎·斯图尔特的格言“物以类聚”。操作系统鼓励我们将文件放入文件夹中,类似的东西放在一起,形成层级结构,随着内容越来越具体,层级结构也随之分支。然而,正如学者书桌的整洁或许能掩盖他们思绪的混乱一样,计算机文件系统看似整洁,却也掩盖了数据在嵌套文件夹的外表下是如何被精心设计的混乱。
The computer science of memory management also reveals exactly how your closet (and your office) ought to be arranged. At first glance, computers appear to follow Martha Stewart’s maxim of “grouping like things together.” Operating systems encourage us to put our files into folders, like with like, forming hierarchies that branch as their contents become ever more specific. But just as the tidiness of a scholar’s desk may hide the messiness of their mind, so does the apparent tidiness of a computer’s file system obscure the highly engineered chaos of how data is actually being stored underneath the nested-folder veneer.
真正发生的事情叫做缓存。
What’s really happening is called caching.
缓存在内存架构中扮演着至关重要的角色,它构成了一切的基础,从毫米级处理器芯片的布局到全球互联网的布局。它为人类生活中各种存储系统和存储库提供了一个新的视角——不仅包括我们的机器,还包括我们的衣柜、办公室、图书馆,以及我们的大脑。
Caching plays a critical role in the architecture of memory, and it underlies everything from the layout of processor chips at the millimeter scale to the geography of the global Internet. It offers a new perspective on all the various storage systems and memory banks of human life—not only our machines, but also our closets, our offices, our libraries. And our heads.
内存层次结构
The Memory Hierarchy
某个女人,意识非常敏锐,但几乎没有记忆……她记得的记忆足够她工作用,而且她工作很努力。
A certain woman had a very sharp consciousness but almost no memory.… She remembered enough to work, and she worked hard.
—莉迪亚·戴维斯
—LYDIA DAVIS
大约从2008年开始,任何想购买新电脑的人在选择存储方案时都会遇到一个特殊的难题。他们必须在容量和速度之间做出权衡。计算机行业目前正处于从硬盘驱动器向固态硬盘驱动器的转型期;在同样的价位下,硬盘驱动器的容量将显著增加,而固态硬盘的性能将显著提升——这一点大多数消费者现在都知道,或者在开始购物时很快就会发现。
Starting roughly around 2008, anyone in the market for a new computer has encountered a particular conundrum when choosing their storage option. They must make a tradeoff between size and speed. The computer industry is currently in transition from hard disk drives to solid-state drives; at the same price point, a hard disk will offer dramatically greater capacity, but a solid-state drive will offer dramatically better performance—as most consumers now know, or soon discover when they begin to shop.
普通消费者可能不知道的是,这种精确的权衡是在机器本身内部以多种规模进行的——以至于它被认为是计算的基本原理之一。
What casual consumers may not know is that this exact tradeoff is being made within the machine itself at a number of scales—to the point where it’s considered one of the fundamental principles of computing.
1946年,普林斯顿高等研究院的亚瑟·伯克斯(Arthur Burks)、赫尔曼·戈德斯坦(Herman Goldstine)和约翰·冯·诺依曼(John von Neumann)提出了一项设计方案,他们称之为电子“记忆器官”。他们写道,在理想世界中,这台机器当然会拥有无限量的闪电般快速的存储空间,但这在实践中是不可能的。(现在仍然无法实现。)于是,这三人提出了他们认为次优的解决方案:“一个存储器层级,每个存储器的容量都比前一个更大,但访问速度较慢。” 通过有效地构建一个由不同形式存储器组成的金字塔——一个小型、快速的存储器和一个大型、缓慢的存储器——或许我们可以以某种方式兼顾两者。
In 1946, Arthur Burks, Herman Goldstine, and John von Neumann, working at the Institute for Advanced Study in Princeton, laid out a design proposal for what they called an electrical “memory organ.” In an ideal world, they wrote, the machine would of course have limitless quantities of lightning-fast storage, but in practice this wasn’t possible. (It still isn’t.) Instead, the trio proposed what they believed to be the next best thing: “a hierarchy of memories, each of which has greater capacity than the preceding but which is less quickly accessible.” By having effectively a pyramid of different forms of memory—a small, fast memory and a large, slow one—maybe we could somehow get the best of both.
记忆层次结构背后的基本思想对于任何曾经使用过图书馆的人来说都应该是直观的。假设你正在研究一篇论文的主题,有一些书你可能需要多次参考。与其每次都回到图书馆,你当然可以借阅相关的书籍,并把它们带回家,这样你就能更轻松地阅读它们。
The basic idea behind a memory hierarchy should be intuitive to anyone who has ever used a library. If you are researching a topic for a paper, let’s say, there are some books you might need to refer to on multiple occasions. Rather than go back to the library each time, you of course check out the relevant books and take them home to your desk, where you can access them more easily.
在计算领域,“内存层次结构”的概念一直停留在理论阶段,直到1962年英国曼彻斯特研发出一台名为Atlas的超级计算机。它的主要内存由一个可以旋转读写信息的大型磁鼓组成,类似于蜡制留声机的圆筒。但Atlas还配备了一个由极化磁铁构成的更小、更快的“工作”内存。数据可以从磁鼓读取到磁铁上,在那里轻松地进行操作,然后将结果写回磁鼓。
In computing, this idea of a “memory hierarchy” remained just a theory until the development in 1962 of a supercomputer in Manchester, England, called Atlas. Its principal memory consisted of a large drum that could be rotated to read and write information, not unlike a wax phonograph cylinder. But Atlas also had a smaller, faster “working” memory built from polarized magnets. Data could be read from the drum to the magnets, manipulated there with ease, and the results then written back to the drum.
在 Atlas 计算机研发后不久,剑桥大学数学家莫里斯·威尔克斯 (Maurice Wilkes) 意识到,这种更小、更快的内存不仅仅是一个方便处理数据并再次保存的地方。它还可以用于特意保存以后可能需要的信息片段,从而预测未来类似的请求,并显著加快机器的运行速度。如果你需要的信息仍在工作内存中,你根本无需从磁鼓中加载。正如威尔克斯所说,较小的内存“会自动将来自较慢主内存的单词累积起来,并将它们保留以供后续使用,而无需再次承受主内存访问的损失。”
Shortly after the development of Atlas, Cambridge mathematician Maurice Wilkes realized that this smaller and faster memory wasn’t just a convenient place to work with data before saving it off again. It could also be used to deliberately hold on to pieces of information likely to be needed later, anticipating similar future requests—and dramatically speeding up the operation of the machine. If what you needed was still in the working memory, you wouldn’t have to load it from the drum at all. As Wilkes put it, the smaller memory “automatically accumulates to itself words that come from a slower main memory, and keeps them available for subsequent use without it being necessary for the penalty of main memory access to be incurred again.”
当然,关键在于管理好那块小巧、快速、宝贵的内存,让它尽可能频繁地提供你所需的内容。继续用图书馆来打比方,如果你只需去一次书架就能取到所有需要的书籍,然后一周剩下的时间都待在家里工作,这几乎相当于图书馆里的所有书籍都已经摆在你的桌子上了。你去图书馆的次数越多,工作进度就越慢,你的办公桌实际上能为你做的也就越少。
The key, of course, would be managing that small, fast, precious memory so it had what you were looking for as often as possible. To continue the library analogy, if you’re able to make just one trip to the stacks to get all the books you need, and then spend the rest of the week working at home, that’s almost as good as if every book in the library had already been available at your desk. The more trips back to the library you make, the slower things go, and the less your desk is really doing for you.
威尔克斯的提议在 20 世纪 60 年代后期被应用于 IBM 360/85 超级计算机,并被命名为“缓存”。从那时起,缓存便在计算机科学领域随处可见。保存经常引用的信息这一理念非常强大,以至于它被应用于计算的各个方面。处理器有缓存。硬盘有缓存。操作系统有缓存。Web 浏览器有缓存。而向这些浏览器提供内容的服务器也拥有缓存,这使得数百万……用户能够立即观看同一部猫骑着吸尘器的视频。不过,我们有点跑题了。
Wilkes’s proposal was implemented in the IBM 360/85 supercomputer later in the 1960s, where it acquired the name of the “cache.” Since then, caches have appeared everywhere in computer science. The idea of keeping around pieces of information that you refer to frequently is so powerful that it is used in every aspect of computation. Processors have caches. Hard drives have caches. Operating systems have caches. Web browsers have caches. And the servers that deliver content to those browsers also have caches, making it possible to instantly show you the same video of a cat riding a vacuum cleaner that millions of … But we’re getting ahead of ourselves a bit.
过去五十多年来,计算机的发展历程被描绘成年复一年的指数级增长——这在一定程度上源于英特尔创始人戈登·摩尔在1975年提出的著名的“摩尔定律”预测,即CPU中晶体管的数量每两年将翻一番。内存的性能却没有以这样的速度提升,这意味着相对于处理时间,访问内存的成本也在呈指数级增长。例如,你写论文的速度越快,每次去图书馆的生产力损失就越大。同样,如果一家工厂每年将生产速度翻一番,但从海外运来的零部件数量却保持不变,而且速度依然缓慢,那么它只不过是一家闲置率翻倍的工厂。一度,摩尔定律似乎只带来了处理器越来越快、越来越长时间的无所事事。在20世纪90年代,这种情况开始被称为“内存墙”。
The story of the computer over the past fifty-plus years has been painted as one of exponential growth year after year—referencing, in part, the famously accurate “Moore’s Law” prediction, made by Intel’s Gordon Moore in 1975, that the number of transistors in CPUs would double every two years. What hasn’t improved at that rate is the performance of memory, which means that relative to processing time, the cost of accessing memory is also increasing exponentially. The faster you can write your papers, for instance, the greater the loss of productivity from each trip to the library. Likewise, a factory that doubles its manufacturing speed each year—but has the same number of parts shipped to it from overseas at the same sluggish pace—will mean little more than a factory that’s twice as idle. For a while it seemed that Moore’s Law was yielding little except processors that twiddled their thumbs ever faster and ever more of the time. In the 1990s this began to be known as the “memory wall.”
计算机科学为了避免遇到这种瓶颈,最好的防御措施就是构建一个越来越复杂的层次结构:缓存、缓存、缓存,层层递进。现代消费类笔记本电脑、平板电脑和智能手机的内存层次结构大致有六层,而巧妙地管理内存对计算机科学来说从未像今天这样重要。
Computer science’s best defense against hitting that wall has been an ever more elaborate hierarchy: caches for caches for caches, all the way down. Modern consumer laptops, tablets, and smartphones have on the order of a six-layer memory hierarchy, and managing memory smartly has never been as important to computer science as it is today.
那么,让我们先来回答关于储藏室(或者说储藏柜)的第一个问题。当它们满了的时候我们该怎么办?
So let’s start with the first question that comes to mind about caches (or closets, for that matter). What do we do when they get full?
驱逐与千里眼
Eviction and Clairvoyance
相信我,每增加一点知识,总有一天你会忘记一些以前知道的东西。因此,最重要的是不要让无用的知识挤掉有用的知识。
Depend upon it there comes a time when for every addition of knowledge you forget something that you knew before. It is of the highest importance, therefore, not to have useless facts elbowing out the useful ones.
—夏洛克·福尔摩斯
—SHERLOCK HOLMES
当缓存写满时,如果要存储其他内容,显然需要腾出空间。在计算机科学中,这种腾出空间的过程被称为“缓存替换”或“缓存驱逐”。正如威尔克斯所写:“由于[缓存]只能容纳主存的一小部分,因此单词无法无限期地保存在主存中,因此系统中必须嵌入一种算法来逐步覆盖它们。” 这些算法被称为“替换策略”或“驱逐策略”,或者简称为缓存算法。
When a cache fills up, you are obviously going to need to make room if you want to store anything else, and in computer science this making of room is called “cache replacement” or “cache eviction.” As Wilkes wrote, “Since the [cache] can only be a fraction of the size of the main memory, words cannot be preserved in it indefinitely, and there must be wired into the system an algorithm by which they are progressively overwritten.” These algorithms are known as “replacement policies” or “eviction policies,” or simply as caching algorithms.
正如我们所见,IBM 在 20 世纪 60 年代的缓存系统部署中发挥了早期作用。毫不奇怪,它也是缓存算法早期开创性研究的发源地——也许没有什么比 László “Les” Bélády 的研究更重要。Bélády 于 1928 年出生于匈牙利,在那里他学习机械工程师,然后在 1956 年匈牙利革命期间逃往德国,身上只有装着“一件换洗内衣和我的毕业论文”的书包。他从德国去了法国,1961 年移民到美国,带着他的妻子,“一个襁褓中的儿子和口袋里的 1,000 美元,仅此而已。”当他加入 IBM 从事缓存驱逐工作时,他似乎已经对什么该保留、什么该丢弃有了敏锐的判断力。
IBM, as we’ve seen, played an early role in the deployment of caching systems in the 1960s. Unsurprisingly, it was also the home of seminal early research on caching algorithms—none, perhaps, as important as that of László “Les” Bélády. Bélády was born in 1928 in Hungary, where he studied as a mechanical engineer before fleeing to Germany during the 1956 Hungarian Revolution with nothing but a satchel containing “one change of underwear and my graduation paper.” From Germany he went to France, and in 1961 immigrated to the United States, bringing his wife, “an infant son and $1,000 in my pocket, and that’s it.” It seems he had acquired a finely tuned sense of what to keep and what to leave behind by the time he found himself at IBM, working on cache eviction.
Bélády 1966 年发表的关于缓存算法的论文,成为了十五年来计算机科学研究中被引用次数最多的论文。正如论文所述,缓存管理的目标是最大限度地减少在缓存中找不到所需内容而必须前往速度较慢的主内存查找的次数;这些次数被称为“页面错误”或“缓存未命中”。Bélády 写道,最佳缓存驱逐策略本质上就是,当缓存已满时,驱逐我们最快可能需要再次访问的内容。
Bélády’s 1966 paper on caching algorithms would become the most cited piece of computer science research for fifteen years. As it explains, the goal of cache management is to minimize the number of times you can’t find what you’re looking for in the cache and must go to the slower main memory to find it; these are known as “page faults” or “cache misses.” The optimal cache eviction policy—essentially by definition, Bélády wrote—is, when the cache is full, to evict whichever item we’ll need again the longest from now.
当然,确切地知道什么时候会再次需要某样东西说起来容易做起来难。
Of course, knowing exactly when you’ll need something again is easier said than done.
假设有一种无所不知、有先见之明的算法,可以预见未来并执行最优策略,如今人们将其称为Bélády 算法。Bélády 算法是计算机科学家所说的“千里眼”算法的一个例子:一种由来自未来的数据提供信息算法。它不一定像听起来那么疯狂——有些情况下系统可能知道会发生什么——但一般来说,千里眼很难获得,软件工程师开玩笑说,当他们试图在实践中部署 Bélády 算法时会遇到“实施困难”。因此,挑战在于找到一种尽可能接近千里眼的算法,用于我们所有那些被困在当下、只能猜测未来会发生什么的时候。
The hypothetical all-knowing, prescient algorithm that would look ahead and execute the optimal policy is known today in tribute as Bélády’s Algorithm. Bélády’s Algorithm is an instance of what computer scientists call a “clairvoyant” algorithm: one informed by data from the future. It’s not necessarily as crazy as it sounds—there are cases where a system might know what to expect—but in general clairvoyance is hard to come by, and software engineers joke about encountering “implementation difficulties” when they try to deploy Bélády’s Algorithm in practice. So the challenge is to find an algorithm that comes as close to clairvoyance as we can get, for all those times when we’re stuck firmly in the present and can only guess at what lies ahead.
我们可以尝试随机驱逐,将新数据添加到缓存并随机覆盖旧数据。缓存理论的早期成果之一是,虽然远非完美,但这种方法还不错。事实上,无论如何维护,只要有缓存就会使系统更高效。经常使用的项目很快就会回到缓存中。另一个简单的策略是先进先出( FIFO ),即驱逐或覆盖缓存中停留时间最长的内容(如玛莎·斯图尔特的问题“我拥有它多久了?”)。第三种方法是最近最少使用(LRU):驱逐时间最长未被触及的物品(斯图尔特的“我上次穿或用它是什么时候?”)。
We could just try Random Eviction, adding new data to the cache and overwriting old data at random. One of the startling early results in caching theory is that, while far from perfect, this approach is not half bad. As it happens, just having a cache at all makes a system more efficient, regardless of how you maintain it. Items you use often will end up back in the cache soon anyway. Another simple strategy is First-In, First-Out (FIFO), where you evict or overwrite whatever has been sitting in the cache the longest (as in Martha Stewart’s question “How long have I had it?”). A third approach is Least Recently Used (LRU): evicting the item that’s gone the longest untouched (Stewart’s “When was the last time I wore it or used it?”).
事实证明,Stewart 的这两个原则不仅意味着截然不同的策略,而且其中一个建议的效果明显优于另一个。Bélády 在多种场景中比较了随机驱逐、先进先出和 LRU 的变体,发现 LRU 的表现始终最接近千里眼。LRU 原则之所以有效,是因为计算机科学家称之为“时间局部性”:如果程序曾经调用过某条特定信息,那么它很可能在不久的将来再次调用。时间局部性部分源于计算机解决问题的方式(例如,执行一个循环,快速进行一系列相关的读写操作),但它也出现在人们解决问题的方式中。如果您正在使用计算机工作,您可能会在电子邮件、网络浏览器和文字处理器之间切换。事实上,您最近访问过其中一个程序,这表明您很可能会再次访问它,而且,在其他条件相同的情况下,您最长时间没有使用的程序很可能也是未来一段时间内不会使用的程序。
It turns out that not only do these two mantras of Stewart’s suggest very different policies, one of her suggestions clearly outperforms the other. Bélády compared Random Eviction, FIFO, and variants of LRU in a number of scenarios and found that LRU consistently performed the closest to clairvoyance. The LRU principle is effective because of something computer scientists call “temporal locality”: if a program has called for a particular piece of information once, it’s likely to do so again in the near future. Temporal locality results in part from the way computers solve problems (for example, executing a loop that makes a rapid series of related reads and writes), but it emerges in the way people solve problems, too. If you are working on your computer, you might be switching among your email, a web browser, and a word processor. The fact that you accessed one of these recently is a clue that you’re likely to do so again, and, all things being equal, the program that you haven’t been using for the longest time is also probably the one that won’t be used for some time to come.
事实上,这一原则甚至隐含在计算机向用户展示的界面中。计算机屏幕上的窗口具有所谓的“Z 轴顺序”,这是一种模拟的深度,用于确定哪些程序覆盖在哪个程序之上。最近最少使用的程序位于底部。正如 Firefox 前创意总监 Aza Raskin 所说:“你使用现代浏览器(计算机)的大部分时间都花在了相当于数字世界中的翻动文件上。”这种“翻动”也完全体现在 Windows 和 Mac OS 的任务切换界面中:当你按下 Alt + Tab 或 Command + Tab 时,你会看到你的应用程序按从最近使用到最少使用的顺序列出。
In fact, this principle is even implicit in the interface that computers show to their users. The windows on your computer screen have what’s called a “Z-order,” a simulated depth that determines which programs are overlaid on top of which. The least recently used end up at the bottom. As former creative lead for Firefox, Aza Raskin, puts it, “Much of your time using a modern browser (computer) is spent in the digital equivalent of shuffling papers.” This “shuffling” is also mirrored exactly in the Windows and Mac OS task switching interfaces: when you press Alt + Tab or Command + Tab, you see your applications listed in order from the most recently to the least recently used.
关于驱逐策略的文献数量之多,几乎无可比拟——包括考虑使用频率和新近度的算法,追踪倒数第二次访问而不是最后一次访问的算法,等等。尽管存在大量创新的缓存方案,其中一些在适当条件下可以胜过 LRU,但 LRU 本身(以及对其进行的细微调整)仍然是计算机科学家的首选,并被广泛应用于各种规模的各种已部署应用程序中。LRU 告诉我们,我们接下来需要的东西可能是我们最后一个需要的东西,而之后我们需要的东西可能是第二近的。而我们最不需要的东西,可能是我们已经很久没有用过的东西。
The literature on eviction policies goes about as deep as one can imagine—including algorithms that account for frequency as well as recency of use, algorithms that track the time of the next-to-last access rather than the last one, and so on. But despite an abundance of innovative caching schemes, some of which can beat LRU under the right conditions, LRU itself—and minor tweaks thereof—is the overwhelming favorite of computer scientists, and is used in a wide variety of deployed applications at a variety of scales. LRU teaches us that the next thing we can expect to need is the last one we needed, while the thing we’ll need after that is probably the second-most-recent one. And the last thing we can expect to need is the one we’ve already gone longest without.
除非我们有充分的理由不这么认为,否则我们通往未来的最佳指南似乎就是过去的镜像。最接近千里眼的,就是假设历史会重演——而且是倒着重演。
Unless we have good reason to think otherwise, it seems that our best guide to the future is a mirror image of the past. The nearest thing to clairvoyance is to assume that history repeats itself—backward.
彻底改造图书馆
Turning the Library Inside Out
在加州大学伯克利分校地下加德纳书库深处,一扇锁着的门后面挂着一张显眼的“仅限员工”牌子,读者完全禁止进入,这里是加州大学图书馆系统的珍宝之一。科马克·麦卡锡、托马斯·品钦、伊丽莎白·毕晓普和 JD 塞林格;阿奈斯·宁、苏珊·桑塔格、朱诺特·迪亚兹和迈克尔·夏邦;安妮·普鲁克斯、马克·斯特兰德和菲利普·K·迪克;威廉·卡洛斯·威廉姆斯、查克·帕拉尼克和托妮·莫里森;丹尼斯·约翰逊、朱莉安娜·斯帕尔、乔里·格雷厄姆和大卫·塞达里斯;西尔维娅·普拉斯、大卫·马梅特、大卫·福斯特·华莱士和尼尔·盖曼……这不是图书馆的稀有书籍收藏;而是它的宝藏。
Deep within the underground Gardner Stacks at the University of California, Berkeley, behind a locked door and a prominent “Staff Only” notice, totally off-limits to patrons, is one of the jewels of the UC library system. Cormac McCarthy, Thomas Pynchon, Elizabeth Bishop, and J. D. Salinger; Anaïs Nin, Susan Sontag, Junot Díaz, and Michael Chabon; Annie Proulx, Mark Strand, and Philip K. Dick; William Carlos Williams, Chuck Palahniuk, and Toni Morrison; Denis Johnson, Juliana Spahr, Jorie Graham, and David Sedaris; Sylvia Plath, David Mamet, David Foster Wallace, and Neil Gaiman … It isn’t the library’s rare book collection; it’s its cache.
正如我们已经讨论过的,当与我们自己的桌面空间结合使用时,图书馆就是内存层次结构的自然示例。事实上,图书馆本身,包括其不同的区域和存储设施,就是具有多层级内存层次结构的一个很好的例子。因此,它们面临着各种各样的缓存问题。它们必须决定将哪些书籍放在图书馆前端有限的展示空间,哪些书籍保留在书架上,以及哪些书籍需要托运到异地存储。不同图书馆对于哪些书籍需要转移至异地存储的政策各不相同,但几乎所有图书馆都使用某种版本的最近最少使用 (LRU) 策略。“例如,对于主书库,”加州大学伯克利分校图书馆负责监督这一流程的贝丝·杜普伊斯 (Beth Dupuis) 说,“如果某本书已经 12 年没有被使用过,那么它就应该被淘汰。”
As we have already discussed, libraries are a natural example of a memory hierarchy when used in concert with our own desk space. In fact, libraries in themselves, with their various sections and storage facilities, are a great example of a memory hierarchy with multiple levels. As a consequence, they face all sorts of caching problems. They have to decide which books to put in the limited display space at the front of the library, which to keep in their stacks, and which to consign to offsite storage. The policy for which books to shunt offsite varies from library to library, but almost all use a version of LRU. “For the Main Stacks, for example,” says Beth Dupuis, who oversees the process in the UC Berkeley libraries, “if an item hasn’t been used in twelve years, that’s the cutoff.”
与这些十几年无人问津的书籍截然相反的是图书馆的“粗略分类”区,我们在上一章中参观过。书籍归还后会先被放在这里,之后才会进行全面分类并重新摆回书架。讽刺的是,辛勤工作的管理员们把书放回书架,从某种意义上来说,反而让它们变得不那么整齐了。
At the other end of the spectrum from the books untouched in a dozen years is the library’s “rough sorting” area, which we visited in the previous chapter. This is where books go just after they are returned, before they’re fully sorted and shelved once again in the stacks. The irony is that the hardworking assistants putting them back on their shelves might, in some sense, be making them less ordered.
原因如下:如果时间局部性成立,那么粗略分类的书架上存放着整栋楼里最重要的书籍。这些书是最近使用过的,因此也是读者最有可能寻找的。图书馆里数英里的书架中,最有价值、最值得浏览的书架既被藏起来,又被认真工作的图书馆工作人员不断侵蚀,这似乎是一种罪过。
Here’s why: if temporal locality holds, then the rough-sorting shelves contain the most important books in the whole building. These are the books that were most recently used, so they are the ones that patrons are most likely to be looking for. It seems a crime that arguably the juiciest and most browseworthy shelf of the libraries’ miles of stacks is both hidden away and constantly eroded by earnest library staff just doing their jobs.
与此同时,莫菲特本科生图书馆的大厅——最显眼、最易取阅的书架所在位置——展示了图书馆最近购入的书籍。这体现了一种先进先出的缓存机制,优先保存的是最新添加到图书馆的书籍,而不是最新阅读的书籍。
Meanwhile, the lobby of the Moffit Undergraduate Library—the location of the most prominent and accessible shelves—showcases the library’s most recently acquired books. This is instantiating a kind of FIFO cache, privileging the items that were last added to the library, not last read.
LRU 算法在计算机科学家进行的大多数测试中都表现出色,这引出了一个简单的建议:把图书馆翻过来。把已购书籍放在图书馆的后部,方便那些想找的人找到它们。把最近归还的书籍放在大厅,方便人们浏览。
The dominant performance of the LRU algorithm in most tests that computer scientists have thrown at it leads to a simple suggestion: turn the library inside out. Put acquisitions in the back, for those who want to find them. And put the most recently returned items in the lobby, where they are ripe for the browsing.
人类是社会性动物,想必本科生群体会觉得探究自身的阅读习惯很有意思。这将推动校园朝着更有机、更自由的方向发展,实现大学指定“共同阅读书籍”的目标:促进知识的共同参考点。在这里,校园里阅读的书籍,无论它们是什么,都将成为其他学生最有可能偶然接触到的书籍。这可以说是一种自下而上的、草根性的公共阅读项目。
Humans are social creatures, and presumably the undergraduate body would find it interesting to peruse its own reading habits. It would nudge the campus toward a more organic and free-form version of what colleges strive for when they assign “common books”: the facilitation of intellectual common points of reference. Here, the books being read on campus, whatever they happened to be, would become the books most likely to be serendipitously encountered by other students. A kind of grassroots, bottom-up analogue of the common book program.
但这样的系统不仅对社会更有利。由于最近归还的书籍最有可能是下次被借出的书籍,它也会更高效。诚然,学生们可能会对热门书籍有时在书库,有时在大厅感到困惑。然而,无论哪种情况,最近归还、等待重新上架的书籍都会从书库中消失。只是目前,在这段短暂的等待期间,它们是禁止进入的。让归还的书籍装饰大厅,可以让学生们有机会完全缩短上架流程。员工无需冒险进入书库存放书籍,学生也无需冒险进入书库取回书籍。这正是缓存的工作原理。
But a system like this wouldn’t only be more socially positive. Since the items most recently returned are the ones most likely to be next checked out, it would also be more efficient. It’s true that students might be puzzled by the fact that popular books will sometimes be found in the stacks and sometimes in the lobby. However, recently returned books that await reshelving are missing from the stacks either way. It’s just that currently they are off-limits during this brief limbo. Allowing the returned books to adorn the lobby instead would give students a chance to short-circuit the shelving process entirely. No employees would have to venture into the stacks to deposit the volumes, and no students would have to venture into the stacks to get them back out. That’s exactly how caching is meant to work.
街道尽头的云
The Cloud at the End of the Street
“我们实际上制作了一张全国地图,比例尺是一英里一英里!”
“We actually made a map of the country, on the scale of a mile to the mile!”
“你经常用它吗?”我问道。
“Have you used it much?” I enquired.
“它还没铺开呢,”迈恩·赫尔说,“农民们反对:他们说它会覆盖整个国家,遮挡阳光!所以我们现在就用整个国家作为地图,我向你保证,效果几乎一样好。”
“It has never been spread out, yet,” said Mein Herr: “the farmers objected: they said it would cover the whole country, and shut out the sunlight! So we now use the country itself, as its own map, and I assure you it does nearly as well.”
—刘易斯·卡罗尔
—LEWIS CARROLL
我们常常认为互联网是一个扁平、独立且松散连接的网络。事实上,它完全不是那样。目前,四分之一的互联网流量由一家公司处理,这家公司几乎完全没有出现在新闻头条中。这家总部位于马萨诸塞州的公司名叫Akamai,从事缓存业务。
We often think of the Internet as a flat, independent, and loosely connected network. In fact, it’s none of those things. A quarter of all Internet traffic at present is handled by a single corporation, one that manages to stay almost entirely out of the headlines. This Massachusetts-based company is called Akamai, and they’re in the caching business.
我们还认为互联网是抽象的、非物质的、后地理化的。我们被告知我们的数据“在云端”,这意味着它位于一个分散的、遥远的地方。同样,这些都不是真的。现实情况是,互联网完全是由一捆捆的物理线路和金属架组成的。而且它与地理的联系比你想象的要紧密得多。
We also think of the Internet as abstract, dematerial, post-geographic. We’re told our data is “in the cloud,” which is meant to suggest a diffuse, distant place. Again, none of these are true. The reality is that the Internet is all about bundles of physical wires and racks of metal. And it’s much more closely tied to geography than you might expect.
工程师在设计计算机硬件时,会从微观角度考虑地理位置:更快的内存通常放置在更靠近处理器的位置,从而最大限度地缩短信息传输所需的线路长度。如今的处理器周期以千兆赫兹为单位,也就是说,它们的运算时间只有几纳秒。这相当于光传播几英寸所需的时间——因此,计算机内部的物理布局至关重要。将同样的原理应用到更大的尺度上,实际的地理位置对于网络的运行至关重要,因为在网络中,线路的跨度可能不止几英寸,而是数千英里。
Engineers think about geography on a tiny scale when they design computer hardware: faster memory is usually placed closer to the processor, minimizing the length of the wires that information has to travel along. Today’s processor cycles are measured in gigahertz, which is to say they are performing operations in fractions of nanoseconds. For reference, that’s the time it takes light to travel a few inches—so the physical layout of a computer’s internals is very much a concern. And applying the same principle at a dramatically larger scale, actual geography turns out to be critical for the functioning of the web, where the wires span not inches but potentially thousands of miles.
如果您可以创建一个网页内容缓存,使其在物理上、地理位置上更接近需要访问的用户,就能更快地提供这些页面。如今,互联网上的大部分流量都由“内容分发网络”(CDN)处理,这些网络的计算机遍布全球,维护着热门网站的副本。这使得请求这些页面的用户可以从附近的计算机获取数据,而无需跨越大洲长途跋涉到原始服务器。
If you can create a cache of webpage content that is physically, geographically closer to the people who want it, you can serve those pages faster. Much of the traffic on the Internet is now handled by “content distribution networks” (CDNs), which have computers around the world that maintain copies of popular websites. This allows users requesting those pages to get their data from a computer that’s nearby, without having to make the long haul across continents to the original server.
这些 CDN 中最大的一个由 Akamai 管理:内容提供商付费让其网站“Akamaized”,以获得更佳性能。例如,一位澳大利亚人从 BBC 观看流媒体视频,很可能访问的是位于悉尼的本地 Akamai 服务器;该请求根本就不会到达伦敦。它完全没有必要。Akamai 首席架构师 Stephen Ludin 表示:“我们的信念——也是我们公司成立的核心理念——距离很重要。”
The largest of these CDNs is managed by Akamai: content providers pay for their websites to be “Akamaized” for better performance. An Australian who streams video from the BBC, for instance, is probably hitting local Akamai servers in Sydney; the request never makes it to London at all. It doesn’t have to. Says Akamai’s chief architect, Stephen Ludin, “It’s our belief—and we build the company around the fact—that distance matters.”
在之前的讨论中,我们提到某些类型的计算机内存性能更快,但单位存储成本更高,因此产生了一种“内存层次结构”,力求兼顾两者。但实际上,缓存并不一定需要由不同的材质构成。当接近性而非性能成为稀缺资源时,缓存同样有用。
In our earlier discussion, we noted that certain types of computer memory have faster performance but cost more per unit of storage, leading to a “memory hierarchy” that tries to get the best of both. But it’s not actually necessary to have memory made of different materials for caching to make sense. Caching is just as useful when it’s proximity, rather than performance, that’s the scarce resource.
这种基本理念——即热门文件应存放在使用地点附近——也适用于纯粹的物理环境。例如,亚马逊庞大的物流中心通常避免任何人类可理解的组织方式,就像图书馆或百货商店里的那种。相反,员工们被要求将新到的物品放在仓库里任何能找到空间的地方——电池与卷笔刀、尿布、烧烤架和学习多布罗琴的DVD紧密摆放——并使用条形码在中央数据库中标记每件物品的位置。但这个故意看起来杂乱无章的存储系统仍然有一个明显的例外:高需求物品被放置在不同的区域,比其他物品更容易取用。这个区域就是亚马逊的缓存区。
This fundamental insight—that in-demand files should be stored near the location where they are used—also translates into purely physical environments. For example, Amazon’s enormous fulfillment centers generally eschew any type of human-comprehensible organization, of the kind you’d find in a library or a department store. Instead, employees are told to place incoming items wherever they can find space in the warehouse—batteries cheek by jowl with pencil sharpeners, diapers, barbecue grills, and learn-the-dobro DVDs—and tag the location of each item in a central database using bar codes. But this deliberately disorganized-looking storage system still has one visible exception: high-demand items are placed in a different area, more quickly accessible than the rest. That area is Amazon’s cache.
最近,亚马逊获得了一项创新专利,将这一原则向前推进了一步。这项专利名为“预期包裹运输”,媒体抓住了这个机会,仿佛亚马逊可以在你购买之前就将商品寄给你。和任何一家科技公司一样,亚马逊也渴望拥有贝拉迪式的“千里眼”——但为了退而求其次,它选择了缓存。他们的专利实际上是将特定地区近期热销的商品运送到该地区的临时仓库——就像亚马逊拥有自己的实体商品CDN一样。然后,当有人下单时,商品就会送到你手上。预测个人的购买情况很有挑战性,但预测几千人的购买情况时,大数定律就派上用场了。比如说,伯克利的某个人会在某一天订购再生卫生纸,而当他们下单时,大部分商品就已经送到了。
Recently, Amazon was granted a patent for an innovation that pushes this principle one step further. The patent talks about “anticipatory package shipping,” which the press seized upon as though Amazon could somehow mail you something before you bought it. Amazon, like any technology company, would love to have that kind of Bélády-like clairvoyance—but for the next best thing, it turns to caching. Their patent is actually for shipping items that have been recently popular in a given region to a staging warehouse in that region—like having their own CDN for physical goods. Then, when somebody places an order, the item is just down the street. Anticipating the purchases of individuals is challenging, but when predicting the purchases of a few thousand people, the law of large numbers kicks in. Somebody in Berkeley is going to order, say, recycled toilet paper in a given day, and when they do it’s already most of the way there.
如果某个地区流行的事物也来自该地区,就会出现更有趣的云地理分布。2011 年,电影评论家 Micah Mertes 使用 Netflix 中每个州的“本地收藏”制作了一张美国地图,突出显示了每个州特别受欢迎的电影。结果发现,绝大多数人喜欢观看以自己居住地为背景的电影。华盛顿人喜欢以西雅图为背景的《单身男女》;路易斯安那人观看以新奥尔良为背景的《大快活》 ;洛杉矶人不出所料喜欢《洛城故事》 ;阿拉斯加人喜欢《勇闯阿拉斯加》;蒙大拿人喜欢《蒙大拿天空》。*而且由于没有什么比构成完整高清视频的庞大文件更能从本地缓存中获益的了,因此 Netflix 肯定会对其进行安排,以便《洛城故事》的文件就存在于洛杉矶,就像它的角色一样——更重要的是,就像它的粉丝一样。
When the things popular in an area are also from that area, an even more interesting geography of the cloud emerges. In 2011, film critic Micah Mertes created a map of the United States using each state’s “Local Favorites” from Netflix—highlighting the movies uncommonly popular in each of those states. Overwhelmingly, it turned out, people love watching movies set where they live. Washingtonians favor Singles, set in Seattle; Louisianans watch The Big Easy, set in New Orleans; Angelinos unsurprisingly enjoy L.A. Story; Alaskans love Braving Alaska; and Montanans, Montana Sky.* And because nothing benefits quite so much from local caching as the enormous files that comprise full-length HD video, it’s certain that Netflix has arranged it so the files for, say, L.A. Story live right in Los Angeles, just like its characters—and, more importantly, its fans.
家庭缓存
Caching on the Home Front
虽然缓存最初是组织计算机内部数字信息的一种方案,但显然它同样适用于组织人类环境中的物理对象。当我们采访斯坦福大学校长、参与开发现代缓存系统的先驱计算机架构师约翰·亨尼西 (John Hennessy) 时,他立即发现了其中的联系:
While caching began as a scheme for organizing digital information inside computers, it’s clear that it is just as applicable to organizing physical objects in human environments. When we spoke to John Hennessy—president of Stanford University, and a pioneering computer architect who helped develop modern caching systems—he immediately saw the link:
缓存是显而易见的事情,因为我们一直在这么做。我的意思是,我获取的信息量……有些东西我必须立即追踪,有些东西我放在桌子上,其他东西则被归档,最终被存入大学档案系统,如果我需要的话,可能需要一整天才能从中取出。但我们一直在使用这种方法来组织我们的生活。
Caching is such an obvious thing because we do it all the time. I mean, the amount of information I get … certain things I have to keep track of right now, a bunch of things I have on my desk, and then other things are filed away, and then eventually filed away into the university archives system where it takes a whole day to get stuff out of it if I wanted. But we use that technique all the time to try to organize our lives.
这些问题之间的直接相似性意味着我们有可能有意识地将计算机科学的解决方案应用到家庭中。
The direct parallel between these problems means that there’s the potential to consciously apply the solutions from computer science to the home.
首先,当你决定哪些东西要保留、哪些东西要扔掉时,LRU 原则可能是一个不错的选择——比 FIFO 好得多。如果你大学时穿的 T 恤现在还偶尔穿,就没必要把它扔掉。但那条你很久没穿的格子裤呢?它们可能是别人在二手店淘到的宝贝。
First, when you are deciding what to keep and what to throw away, LRU is potentially a good principle to use—much better than FIFO. You shouldn’t necessarily toss that T-shirt from college if you still wear it every now and then. But the plaid pants you haven’t worn in ages? Those can be somebody else’s thrift-store bonanza.
其次,利用地理位置。确保物品存放在离常用地点最近的储藏处。大多数家居整理书籍中并没有具体的建议,但在实际使用中,人们认为效果良好的整理方案中却屡见不鲜。例如,朱莉·摩根斯坦的《由内而外整理》一书中引用了一位用户的话:“我把跑步和运动装备放在前门衣帽间地板上的一个箱子里。我喜欢把它们放在靠近前门的地方。”
Second, exploit geography. Make sure things are in whatever cache is closest to the place where they’re typically used. This isn’t a concrete recommendation in most home-organization books, but it consistently turns up in the schemes that actual people describe as working well for them. “I keep running and exercise gear in a crate on the floor of my front coat closet,” says one person quoted in Julie Morgenstern’s Organizing from the Inside Out, for instance. “I like having it close to the front door.”
威廉·琼斯 (William Jones)所著的《保留找到的东西》一书中出现了一个稍微极端的例子:
A slightly more extreme example appears in the book Keeping Found Things Found, by William Jones:
一位医生跟我讲过她整理东西的方法。“孩子们觉得我古怪,但我会把东西放在以后还会用到的地方,即使这没什么意义。” 举个例子,她告诉我,她会在客厅的沙发后面放一些备用的吸尘器吸尘袋。放在客厅的沙发后面?这说得通吗?……原来,吸尘器通常用来清洁客厅的地毯……当吸尘器的吸尘袋满了需要换新的时,通常都会放在客厅里。而吸尘器的吸尘袋就放在客厅里。
A doctor told me about her approach to keeping things. “My kids think I’m whacky, but I put things where I think I’ll need them again later, even if it doesn’t make much sense.” As an example of her system, she told me that she keeps extra vacuum cleaner bags behind the couch in the living room. Behind the couch in the living room? Does that make any sense?… It turns out that when the vacuum cleaner is used, it is usually used for the carpet in the living room.… When a vacuum cleaner bag gets full and a new one is needed, it’s usually in the living room. And that’s just where the vacuum cleaner bags are.
最后一点,虽然还没有被纳入衣柜整理指南,但多级内存层次结构是关键。拥有缓存固然高效,但拥有多层级的缓存——从最小最快到最大最慢——效果会更好。就你的物品而言,你的衣柜是一层缓存,你的地下室是另一层,自助储物柜是第三层。(当然,这些缓存是按访问速度递减的,所以你应该使用 LRU 原则来决定哪些东西从每一层移到下一层。)但你或许还可以通过添加另一层缓存来加快速度:一个比你的衣柜更小、更快、更近的缓存。
A final insight, which hasn’t yet made it into guides on closet organization, is that of the multi-level memory hierarchy. Having a cache is efficient, but having multiple levels of caches—from smallest and fastest to largest and slowest—can be even better. Where your belongings are concerned, your closet is one cache level, your basement another, and a self-storage locker a third. (These are in decreasing order of access speed, of course, so you should use the LRU principle as the basis for deciding what gets evicted from each level to the next.) But you might also be able to speed things up by adding yet another level of caching: an even smaller, faster, closer one than your closet.
汤姆的妻子原本非常宽容,反对在床边堆放一堆衣服,尽管汤姆坚称这实际上是一种高效的缓存方案。幸运的是,我们与计算机科学家的交流也找到了解决这个问题的方法。加州大学圣地亚哥分校的里克·贝卢(Rik Belew)从认知角度研究搜索引擎,他推荐使用衣帽架。虽然现在很少见到这种衣帽架,但它本质上是一个单件衣服的衣橱,一个可以挂夹克、领带和裤子的复合衣架——是满足你家庭衣物缓存需求的完美硬件。这表明,计算机科学家不仅能节省你的时间,他们或许还能挽救你的婚姻。
Tom’s otherwise extremely tolerant wife objects to a pile of clothes next to the bed, despite his insistence that it’s in fact a highly efficient caching scheme. Fortunately, our conversations with computer scientists revealed a solution to this problem too. Rik Belew of UC San Diego, who studies search engines from a cognitive perspective, recommended the use of a valet stand. Though you don’t see too many of them these days, a valet stand is essentially a one-outfit closet, a compound hanger for jacket, tie, and slacks—the perfect piece of hardware for your domestic caching needs. Which just goes to show that computer scientists won’t only save you time; they might also save your marriage.
归档和堆放
Filing and Piling
决定了要保留什么以及应该放在哪里之后,最后的挑战是如何整理它们。我们已经讨论过衣柜里应该放什么以及应该放在哪里,但是里面的东西应该如何摆放呢?
After deciding what to keep and where it should go, the final challenge is knowing how to organize it. We’ve talked about what goes in the closet and where the closet should be, but how should things be arranged inside?
到目前为止,我们看到的所有家庭整理建议中,有一个不变的理念,就是将“同类物品归类”——也许没有人像野口幸雄那样直接违背这一建议。野口幸雄说:“我必须强调,我的方法中一个非常基本的原则是不要根据内容分组文件。”野口幸雄是东京大学的经济学家,著有一系列书籍,提供整理办公室和生活的“超级”技巧。这些书籍的名称大致可以翻译为超级说服法、超级工作法、超级学习法——以及与我们最相关的超级整理法。
One of the constants across all pieces of home-organization advice we’ve seen so far is the idea of grouping “like with like”—and perhaps no one so directly flies in the face of that advice as Yukio Noguchi. “I have to emphasize,” says Noguchi, “that a very fundamental principle in my method is not to group files according to content.” Noguchi is an economist at the University of Tokyo, and the author of a series of books that offer “super” tricks for sorting out your office and your life. Their titles translate roughly to Super Persuasion Method, Super Work Method, Super Study Method—and, most relevantly for us, Super Organized Method.
野口勇在其经济学家生涯早期,经常被海量信息淹没——信函、数据、手稿——每天要花大量时间整理这些信息。于是,他开始寻找替代方案。起初,他只是简单地将每份文件放入一个文件夹,并标明文件标题和日期,然后将所有文件放入一个大盒子里。这样做节省了时间——他不用费心思考每份文件的正确位置——但最终却没有形成任何形式的整理。后来,在20世纪90年代初的某个时候,他取得了突破:他开始将文件专门放在盒子的左侧。于是,“超级”文件系统诞生了。
Early in his career as an economist, Noguchi found himself constantly inundated with information—correspondence, data, manuscripts—and losing a significant portion of each day just trying to organize it all. So he looked for an alternative. He began by simply putting each document into a file labeled with the document’s title and date, and putting all the files into one big box. That saved time—he didn’t have to think about the right place to put each document—but it didn’t result in any form of organization. Then, sometime in the early 1990s, he had a breakthrough: he started to insert the files exclusively at the left-hand side of the box. And thus the “super” filing system was born.
野口勇指出,左侧插入规则对于新旧文件都适用:每次取出文件使用其内容时,放回文件箱时必须将其作为最左侧文件放回。搜索文件时也始终从左侧开始。因此,最近访问的文件最容易找到。
The left-side insertion rule, Noguchi specifies, has to be followed for old files as well as new ones: every time you pull out a file to use its contents, you must put it back as the leftmost file when you return it to the box. And when you search for a file, you always start from the left-hand side as well. The most recently accessed files are thus the fastest to find.
野口勇解释说,他之所以开始这样做,是因为把所有文件放回左侧比把文件重新放回原处要容易得多。他逐渐意识到,这种方法不仅简单,而且效率惊人。
This practice began, Noguchi explains, because returning every file to the left side was just easier than trying to reinsert it at the same spot it came from. Only gradually did he realize that this procedure was not only simple but also startlingly efficient.
野口文件系统在使用完毕后重新整理物品时,确实能节省时间。然而,仍然存在一个问题:这是否是一个找到所需文件的好方法?毕竟,它显然违背了其他效率大师的建议,他们建议我们将类似的东西放在一起。事实上,即使是“组织”一词的词源,也让人联想到由器官组成的身体——这些器官就是由“同类”细胞组成的,它们按照相似的形态和功能排列在一起。
The Noguchi Filing System clearly saves time when you’re replacing something after you’re done using it. There’s still the question, however, of whether it’s a good way to find the files you need in the first place. After all, it certainly goes against the recommendations of other efficiency gurus, who tell us that we should put similar things together. Indeed, even the etymology of the word “organized” evokes a body composed of organs—which are nothing if not cells grouped “like with like,” marshalled together by similar form and function.
但计算机科学给了我们大多数效率大师所没有的东西:保证。
But computer science gives us something that most efficiency gurus don’t: guarantees.
尽管野口当时并不知道,但他的文件系统是 LRU 原则的延伸。LRU 告诉我们,当我们向缓存中添加内容时,应该丢弃最旧的项目,但它并没有告诉我们应该将新项目放在哪里。这个问题的答案来自 20 世纪 70 年代和 80 年代计算机科学家进行的一系列研究。他们对这个问题的解释称为“自组织列表”,其设置几乎完全模仿了野口的归档难题。想象一下,你有一组按序列排列的项目,你必须定期搜索它们以找到特定的项目。搜索本身被限制为线性的——你必须从头开始逐个查看项目——但是一旦找到你要找的项目,你可以将它放回序列中的任何位置。你应该在哪里替换这些项目才能使搜索尽可能高效?
Though Noguchi didn’t know it at the time, his filing system represents an extension of the LRU principle. LRU tells us that when we add something to our cache we should discard the oldest item—but it doesn’t tell us where we should put the new item. The answer to that question comes from a line of research carried out by computer scientists in the 1970s and ’80s. Their version of the problem is called “self-organizing lists,” and its setup almost exactly mimics Noguchi’s filing dilemma. Imagine that you have a set of items in a sequence, and you must periodically search through them to find specific items. The search itself is constrained to be linear—you must look through the items one by one, starting at the beginning—but once you find the item you’re looking for, you can put it back anywhere in the sequence. Where should you replace the items to make searching as efficient as possible?
1985 年,丹尼尔·斯莱特 (Daniel Sleator) 和罗伯特·塔尔扬 (Robert Tarjan) 发表了一篇关于自组织列表的权威论文,该论文以经典的计算机科学方式,考察了在所有可能的请求序列下,各种列表组织方式的最坏情况性能。直观地说,由于搜索从最前面开始,你希望对序列进行排序,以便最有可能被搜索到的项目出现在那里。但这些项目会是哪些呢?我们又回到了对千里眼的期盼。“如果你提前知道序列,”塔尔扬说道,他在普林斯顿和硅谷两地工作,“你就可以自定义数据结构,以最小化整个序列的总时间。这就是最优的离线算法:如果你愿意,可以称之为上帝的算法,或者天上的算法。当然,没有人知道未来,所以问题是,如果你不知道未来,你能在多大程度上接近这个天上的最优算法?” Sleator 和 Tarjan 的研究结果表明,一些“非常简单的自调整方案,令人惊讶的是,其精度与预知能力的精度相差无几”。也就是说,如果你遵循 LRU 原则——即始终将某个项目放回到列表的最前面——那么你搜索的总时间绝不会超过预知未来的两倍。其他任何算法都无法做到这一点。
The definitive paper on self-organizing lists, published by Daniel Sleator and Robert Tarjan in 1985, examined (in classic computer science fashion) the worst-case performance of various ways to organize the list given all possible sequences of requests. Intuitively, since the search starts at the front, you want to arrange the sequence so that the items most likely to be searched for appear there. But which items will those be? We’re back to wishing for clairvoyance again. “If you know the sequence ahead of time,” says Tarjan, who splits his time between Princeton and Silicon Valley, “you can customize the data structure to minimize the total time for the entire sequence. That’s the optimum offline algorithm: God’s algorithm if you will, or the algorithm in the sky. Of course, nobody knows the future, so the question is, if you don’t know the future, how close can you come to this optimum algorithm in the sky?” Sleator and Tarjan’s results showed that some “very simple self-adjusting schemes, amazingly, come within a constant factor” of clairvoyance. Namely, if you follow the LRU principle—where you simply always put an item back at the very front of the list—then the total amount of time you spend searching will never be more than twice as long as if you’d known the future. That’s not a guarantee any other algorithm can make.
将野口文件系统视为 LRU 原则的一个实际应用实例,可以告诉我们它不仅仅是高效的,它实际上是最优的。
Recognizing the Noguchi Filing System as an instance of the LRU principle in action tells us that it is not merely efficient. It’s actually optimal.
Sleator 和 Tarjan 的研究结果还为我们提供了另一个可能性,我们通过将野口文件归档系统翻转过来来实现。简而言之,一盒文件侧放后就变成了一堆。而文件堆的本质就是你需要从上到下搜索,每次你取出一份文件时,它都不会回到你找到它的位置,而是回到最上面。*
Sleator and Tarjan’s results also provide us with one further twist, and we get it by turning the Noguchi Filing System on its side. Quite simply, a box of files on its side becomes a pile. And it’s the very nature of piles that you search them from top to bottom, and that each time you pull out a document it goes back not where you found it, but on top.*
简而言之,自组织列表的数学原理暗示着某种激进的理念:你桌上那一大堆文件,远非令人内疚的混乱滋生地,反而是现有设计最精良、最高效的结构之一。在别人看来杂乱无章的东西,实际上却是自组织的混乱。在无法预知未来的情况下,把东西扔回堆顶是你所能做的最好的事情。在上一章中,我们探讨了一些案例,其中将某些东西置之不理比花时间将所有东西都整理得更有效率;然而,这里,我们却用一个截然不同的理由来解释为什么你不需要整理它们。
In short, the mathematics of self-organizing lists suggests something radical: the big pile of papers on your desk, far from being a guilt-inducing fester of chaos, is actually one of the most well-designed and efficient structures available. What might appear to others to be an unorganized mess is, in fact, a self-organizing mess. Tossing things back on the top of the pile is the very best you can do, shy of knowing the future. In the previous chapter we examined cases where leaving something unsorted was more efficient than taking the time to sort everything; here, however, there’s a very different reason why you don’t need to organize it.
你已经有了。
You already have.
遗忘曲线
The Forgetting Curve
当然,任何关于记忆的讨论,如果不提及最贴近我们生活的“记忆器官”——人类大脑,就不算完整。过去几十年来,计算机科学的影响在某种程度上彻底改变了心理学家对记忆的理解。
Of course, no discussion of memory could be complete without mention of the “memory organ” closest to home: the human brain. Over the past few decades, the influence of computer science has brought about something of a revolution in how psychologists think about memory.
据说,人类记忆科学始于1879年,由柏林大学一位名叫赫尔曼·艾宾浩斯的年轻心理学家开创。艾宾浩斯想要探究人类记忆的运作机制,并证明运用物理科学的数学严谨性来研究思维是可能的。于是,他开始在自己身上进行实验。
The science of human memory is said to have begun in 1879, with a young psychologist at the University of Berlin named Hermann Ebbinghaus. Ebbinghaus wanted to get to the bottom of how human memory worked, and to show that it was possible to study the mind with all the mathematical rigor of the physical sciences. So he began to experiment on himself.
艾宾浩斯每天都会坐下来,背诵一串无意义的音节。然后,他会用前几天的清单来测试自己。坚持这个习惯一年多,他得出了人类记忆研究中许多最基本的结论。例如,他证实,多次练习一个清单可以让它在记忆中停留更长时间,而随着时间的推移,人们能够准确回忆起的条目数量会减少。他的研究结果绘制出了一张记忆随时间消退的曲线,如今被心理学家称为“遗忘曲线”。
Each day, Ebbinghaus would sit down and memorize a list of nonsense syllables. Then he would test himself on lists from previous days. Pursuing this habit over the course of a year, he established many of the most basic results in human memory research. He confirmed, for instance, that practicing a list multiple times makes it persist longer in memory, and that the number of items one can accurately recall goes down as time passes. His results mapped out a graph of how memory fades over time, known today by psychologists as “the forgetting curve.”
艾宾浩斯的研究结果确立了人类记忆定量科学的可信度,但也留下了一些未解之谜。为什么会出现这条特殊的曲线?它是否暗示了人类记忆是好是坏?这背后的原因是什么?一百多年来,这些问题一直激发着心理学家们的思考和研究。
Ebbinghaus’s results established the credibility of a quantitative science of human memory, but they left open something of a mystery. Why this particular curve? Does it suggest that human memory is good or bad? What’s the underlying story here? These questions have stimulated psychologists’ speculation and research for more than a hundred years.
1987年,卡内基梅隆大学的心理学家兼计算机科学家约翰·安德森(John Anderson)偶然发现了一些关于大学图书馆信息检索系统的资料。安德森的目标——或者说他自认为如此——是想写一篇关于如何通过人类记忆研究来指导这些系统的设计的文章。然而,事与愿违:他意识到信息科学可以填补心智研究中缺失的一块拼图。
In 1987, Carnegie Mellon psychologist and computer scientist John Anderson found himself reading about the information retrieval systems of university libraries. Anderson’s goal—or so he thought—was to write about how the design of those systems could be informed by the study of human memory. Instead, the opposite happened: he realized that information science could provide the missing piece in the study of the mind.
安德森说:“很长一段时间以来,我都觉得现有的人类记忆理论,包括我自己的理论,都缺少了一些东西。基本上,所有这些理论都将记忆描述为一种任意且非最优的配置……我一直认为基本的记忆过程具有很强的适应性,甚至可能是最优的;然而,我从未找到一个能够支撑这一观点的框架。在信息检索的计算机科学研究中,我看到了这个框架在我面前展现出来。”
“For a long time,” says Anderson, “I had felt that there was something missing in the existing theories of human memory, including my own. Basically, all of these theories characterize memory as an arbitrary and non-optimal configuration.… I had long felt that the basic memory processes were quite adaptive and perhaps even optimal; however, I had never been able to see a framework in which to make this point. In the computer science work on information retrieval, I saw that framework laid out before me.”
一种自然的思考遗忘的方式是,我们的大脑只是空间不足而已。安德森对人类记忆的新解释背后的关键思想是,问题可能不在于存储,而在于组织。根据他的理论,大脑本质上拥有无限的记忆容量,但我们只有有限的时间来搜索它们。安德森将之比作一个只有一个任意长书架的图书馆——相当于美国国会图书馆规模的野口勇文件系统。你可以在书架上放任意数量的东西,但越靠近前面的东西就越快找到。
A natural way to think about forgetting is that our minds simply run out of space. The key idea behind Anderson’s new account of human memory is that the problem might be not one of storage, but of organization. According to his theory, the mind has essentially infinite capacity for memories, but we have only a finite amount of time in which to search for them. Anderson made the analogy to a library with a single, arbitrarily long shelf—the Noguchi Filing System at Library of Congress scale. You can fit as many items as you want on that shelf, but the closer something is to the front the faster it will be to find.
人类良好记忆的关键就与计算机良好缓存的关键相同:预测未来最有可能需要哪些物品。
The key to a good human memory then becomes the same as the key to a good computer cache: predicting which items are most likely to be wanted in the future.
除非有千里眼,在人类世界中做出此类预测的最佳方法需要了解世界本身。安德森与他的合作伙伴莱尔·斯库勒一起着手进行类似艾宾浩斯的研究,研究的不是人类思维,而是人类社会。问题很简单:哪些模式表征了世界本身的“遗忘”方式——事件和参考资料如何随着时间的推移而消失?安德森和斯库勒分析了三种人类环境:《纽约时报》的头条新闻、父母与孩子谈话的录音以及安德森自己的电子邮件收件箱。在所有领域中,他们发现一个词最有可能在刚刚使用后再次出现,而随着时间的推移,再次看到它的可能性会下降。
Barring clairvoyance, the best approach to making such predictions in the human world requires understanding the world itself. With his collaborator Lael Schooler, Anderson set out to perform Ebbinghaus-like studies not on human minds, but on human society. The question was straightforward: what patterns characterize the way the world itself “forgets”—the way that events and references fade over time? Anderson and Schooler analyzed three human environments: headlines from the New York Times, recordings of parents talking to their children, and Anderson’s own email inbox. In all domains, they found that a word is most likely to appear again right after it had just been used, and that the likelihood of seeing it again falls off as time goes on.
换句话说,现实本身具有模仿艾宾浩斯曲线的统计结构。
In other words, reality itself has a statistical structure that mimics the Ebbinghaus curve.
这暗示着一些非凡的事情。如果事物从我们脑海中消失的模式,正是我们周围事物逐渐被遗忘的模式,那么艾宾浩斯遗忘曲线或许真的有一个很好的解释——也就是说,它是大脑对世界的一种完美调节,恰好能提供那些最有可能需要的东西。
This suggests something remarkable. If the pattern by which things fade from our minds is the very pattern by which things fade from use around us, then there may be a very good explanation indeed for the Ebbinghaus forgetting curve—namely, that it’s a perfect tuning of the brain to the world, making available precisely the things most likely to be needed.
人类记忆与人类环境。左图显示了艾宾浩斯从列表中正确回忆起的无意义音节的百分比,该百分比是他首次记住列表后等待的小时数的函数。右图显示了某个单词在特定日期出现在《 纽约时报》头条新闻中的概率 ,该百分比是该单词上次出现在印刷版中的时间的函数。
Human memory and human environments. The left panel shows the percentage of nonsense syllables Ebbinghaus correctly recalled from a list, as a function of the number of hours he waited after first memorizing the list. The right panel shows the chance that a word appears in the headlines of the New York Times on a given day, as a function of the time since its previous appearance in print.
缓存强调时间的重要性,它向我们表明,记忆包含着不可避免的权衡,以及某种程度的零和博弈。你不可能把图书馆里的每一本书都摆在你的桌子上,不可能把商店橱窗里陈列的每一件商品都摆在你的面前,不可能把每一份标题都摆在你的头版,也不可能把每一份报纸都摆在你的最上面。同样,你也不可能把所有的事实、面孔或名字都放在你的脑海里。
In putting the emphasis on time, caching shows us that memory involves unavoidable tradeoffs, and a certain zero-sumness. You can’t have every library book at your desk, every product on display at the front of the store, every headline above the fold, every paper at the top of the pile. And in the same way, you can’t have every fact or face or name at the front of your mind.
“许多人持有偏见,认为人类记忆并非最佳状态,”安德森和斯库勒写道。“他们指出记忆存在许多令人沮丧的缺陷。然而,这些批评忽视了人类记忆面临的任务,即试图管理海量的记忆。任何负责管理海量数据库的系统都必然存在检索缺陷。维护对无限量数据的访问成本实在太高。”
“Many people hold the bias that human memory is anything but optimal,” wrote Anderson and Schooler. “They point to the many frustrating failures of memory. However, these criticisms fail to appreciate the task before human memory, which is to try to manage a huge stockpile of memories. In any system responsible for managing a vast data base there must be failures of retrieval. It is just too expensive to maintain access to an unbounded number of items.”
这种理解反过来又引出了关于人类记忆的第二个启示。如果这些权衡真的不可避免,而且大脑似乎对周围世界保持着最佳的适应状态,那么我们所说的随着年龄增长而不可避免的“认知衰退”实际上可能另有隐情。
This understanding has in turn led to a second revelation about human memory. If these tradeoffs really are unavoidable, and the brain appears to be optimally tuned to the world around it, then what we refer to as the inevitable “cognitive decline” that comes with age may in fact be something else.
经验的暴政
The Tyranny of Experience
大书会带来很大的麻烦。
A big book is a big nuisance.
——卡利马科斯(CALLIMACHUS,公元前 305-410 年),亚历山大图书馆馆长
—CALLIMACHUS (305–410 BC), LIBRARIAN AT ALEXANDRIA
他们为什么不利用黑匣子来制造整架飞机呢?
Why don’t they make the whole plane out of that black box stuff?
—史蒂文·赖特
—STEVEN WRIGHT
计算机内存层次结构(以级联缓存的形式)之所以需要,很大程度上是因为我们无力承担用最昂贵的硬件制造整个内存的成本。例如,当前计算机上最快的缓存是由所谓的 SRAM 构成的,其每字节成本大约是固态硬盘中闪存的 1000 倍。但缓存的真正动机远不止于此。事实上,即使我们能得到一台只使用尽可能快的内存的定制机器,我们仍然需要缓存。
The need for a computer memory hierarchy, in the form of a cascade of caches, is in large part the result of our inability to afford making the entire memory out of the most expensive type of hardware. The fastest cache on current computers, for instance, is made with what’s called SRAM, which costs roughly a thousand times as much per byte as the flash memory in solid-state drives. But the true motivation for caching goes deeper than that. In fact, even if we could get a bespoke machine that used exclusively the fastest form of memory possible, we’d still need caches.
正如约翰·轩尼诗 (John Hennessy) 所解释的那样,单是尺寸就足以影响速度:
As John Hennessy explains, size alone is enough to impair speed:
东西越大,速度自然就越慢,对吧?如果城市越大,从A点到B点的路程就会越长。如果图书馆越大,在图书馆里找书也会越费时。如果桌上有一叠更大的纸,找到你要找的那张纸也会越费时,对吧?缓存其实就是解决这个问题的……比如,现在你去买一个处理器,芯片上会有一个一级缓存和一个二级缓存。之所以有——哪怕只是一块芯片上就有两级缓存!——是因为为了跟上处理器的运行频率,一级缓存的大小是有限的。
When you make something bigger, it’s inherently slower, right? If you make a city bigger, it takes longer to get from point A to point B. If you make a library bigger, it takes longer to find a book in the library. If you have a stack of papers on your desk that’s bigger, it takes longer to find the paper you’re looking for, right? Caches are actually a solution to that problem.… For example, right now, if you go to buy a processor, what you’ll get is a Level 1 cache and a Level 2 cache on the chip. The reason that there are—even just on the chip there are two caches!—is that in order to keep up with the cycle rate of the processor, the first-level cache is limited in size.
不可避免的是,内存越大,从中搜索和提取信息所需的时间就越长。
Unavoidably, the larger a memory is, the more time it takes to search for and extract a piece of information from it.
布莱恩和汤姆,年逾三十,已经发现自己越来越频繁地在谈话中拖延时间,比如,等着某个“即将脱口而出”的人的名字浮现在脑海中。布莱恩十岁时有二十多个同学;二十年后,他的手机里有数百个联系人,脸书上有数千个联系人,并且已经在四个城市生活过,每个城市都有自己的朋友、熟人和同事圈子。汤姆在学术生涯的这个阶段,已经与数百位合作者合作,教授了数千名学生。(事实上,这本书就涉及与大约一百人会面,并引用了一千人的话。)当然,这种影响绝不限于社会联系:一个典型的两岁儿童认识两百个单词;一个典型的成年人认识三万个单词。至于情景记忆,每年都会为一个人的总生活经验增加三十万分钟的清醒时间。
Brian and Tom, in their thirties, already find themselves more frequently stalling a conversation as, for instance, they wait for the name of someone “on the tip of the tongue” to come to mind. Then again, Brian at age ten had two dozen schoolmates; twenty years later he has hundreds of contacts in his phone and thousands on Facebook, and has lived in four cities, each with its own community of friends, acquaintances, and colleagues. Tom, by this point in his academic career, has worked with hundreds of collaborators and taught thousands of students. (In fact, this very book involved meeting with about a hundred people and citing a thousand.) Such effects are by no means limited to social connections, of course: a typical two-year-old knows two hundred words; a typical adult knows thirty thousand. And when it comes to episodic memory, well, every year adds a third of a million waking minutes to one’s total lived experience.
如此一来,我们俩——或者说任何人——的思维竟然还能跟上,真是个奇迹。令人惊讶的并非记忆力的减慢,而是在如此海量数据积累的情况下,大脑竟然还能保持运转并保持反应。
Considered this way, it’s a wonder that the two of us—or anyone—can mentally keep up at all. What’s surprising is not memory’s slowdown, but the fact that the mind can possibly stay afloat and responsive as so much data accumulates.
如果记忆的根本挑战真的在于组织而非存储,或许我们应该改变对衰老对心智能力影响的看法。图宾根大学迈克尔·拉姆斯卡(Michael Ramscar)领导的心理学家和语言学家团队最近开展的一项研究表明,我们所谓的“认知衰退”——记忆滞后和检索错误——可能并非源于搜索过程的减慢或退化,而是(至少在一定程度上)我们需要处理的信息量越来越大所带来的不可避免的后果。无论衰老带来什么其他挑战,老年人的大脑——它们必须管理更大的记忆库——实际上每天都在解决更难的计算问题。老年人可以嘲笑年轻人的速度:“那是因为你还什么都不懂!”
If the fundamental challenge of memory really is one of organization rather than storage, perhaps it should change how we think about the impact of aging on our mental abilities. Recent work by a team of psychologists and linguists led by Michael Ramscar at the University of Tübingen has suggested that what we call “cognitive decline”—lags and retrieval errors—may not be about the search process slowing or deteriorating, but (at least partly) an unavoidable consequence of the amount of information we have to navigate getting bigger and bigger. Regardless of whatever other challenges aging brings, older brains—which must manage a greater store of memories—are literally solving harder computational problems with every passing day. The old can mock the young for their speed: “It’s because you don’t know anything yet!”
拉姆斯卡的团队以语言为例,展示了额外信息对人类记忆的影响。通过一系列模拟,研究人员发现,仅仅掌握的知识越多,识别单词、名称甚至字母就越困难。无论你的组织方案多么完善,搜索更多内容必然会耗费更长的时间。这并不是说我们在遗忘,而是我们在记忆。我们正在成为档案库。
Ramscar’s group demonstrated the impact of extra information on human memory by focusing on the case of language. Through a series of simulations, the researchers showed that simply knowing more makes things harder when it comes to recognizing words, names, and even letters. No matter how good your organization scheme is, having to search through more things will inevitably take longer. It’s not that we’re forgetting; it’s that we’re remembering. We’re becoming archives.
拉姆斯卡表示,理解记忆不可避免的计算需求,应该有助于人们正视衰老对认知的影响。“我认为老年人能做的最重要的实际事情,就是努力理解大脑是天然的信息处理设备,”他写道。“随着年龄增长,有些事情可能会让我们感到沮丧(比如记住名字!),但这与我们需要筛选的信息量有关……并不一定意味着心智衰退。” 正如他所说,“目前所谓的衰退,很多其实只是学习而已。”
An understanding of the unavoidable computational demands of memory, Ramscar says, should help people come to terms with the effects of aging on cognition. “I think the most important tangible thing seniors can do is to try to get a handle on the idea that their minds are natural information processing devices,” he writes. “Some things that might seem frustrating as we grow older (like remembering names!) are a function of the amount of stuff we have to sift through … and are not necessarily a sign of a failing mind.” As he puts it, “A lot of what is currently called decline is simply learning.”
缓存让我们能够理解正在发生的事情。我们说“脑子进水了”,其实应该说“缓存未命中”。信息检索中偶尔出现的不成比例的延迟提醒着我们,把需要的信息放在首位,对我们在其余时间里有多么有益。
Caching gives us the language to understand what’s happening. We say “brain fart” when we should really say “cache miss.” The disproportionate occasional lags in information retrieval are a reminder of just how much we benefit the rest of the time by having what we need at the front of our minds.
所以,随着年龄的增长,当你开始经历这些零星的延迟时,请振作起来:延迟的长短在一定程度上反映了你经验的广度。检索知识的努力程度证明了你的知识量。而延迟的罕见性则证明了你安排得多么周全:把最重要的东西放在手边。
So as you age, and begin to experience these sporadic latencies, take heart: the length of a delay is partly an indicator of the extent of your experience. The effort of retrieval is a testament to how much you know. And the rarity of those lags is a testament to how well you’ve arranged it: keeping the most important things closest to hand.
*不知什么原因,《我的私人爱达荷》在缅因州最受欢迎。
*For unknown reasons, My Own Private Idaho is best loved in Maine.
*您还可以强制计算机将电子文档显示为一堆。计算机默认的文件浏览界面会让您按字母顺序浏览文件夹——但 LRU 的强大功能建议您覆盖此设置,并按“上次打开”而不是“名称”显示文件。您要查找的文件几乎总是位于顶部或顶部附近。
*You can force your computer to show your electronic documents in a pile, as well. Computers’ default file-browsing interface makes you click through folders in alphabetical order—but the power of LRU suggests that you should override this, and display your files by “Last Opened” rather than “Name.” What you’re looking for will almost always be at or near the top.
我们如何度过每一天,当然就是我们如何度过一生。
How we spend our days is, of course, how we spend our lives.
—安妮·迪拉德
—ANNIE DILLARD
“我们为什么不写一本关于调度理论的书呢?”我问道……“应该不会花太多时间!”写书就像打仗一样,常常会导致严重的失算。十五年后, 《调度》 仍然未完成。
“Why don’t we write a book on scheduling theory?” I asked.… “It shouldn’t take much time!” Book-writing, like war-making, often entails grave miscalculations. Fifteen years later, Scheduling is still unfinished.
—尤金·劳勒
—EUGENE LAWLER
星期一早上,你的日程表还空白着,还有一长串任务需要完成。有些任务必须等其他任务完成后才能开始(比如,洗碗机必须先卸载,才能装碗),有些任务必须在特定时间后才能开始(比如,如果你在周二晚上之前把垃圾放在路边,邻居会抱怨的)。有些任务有严格的截止日期,有些任务可以随时完成,还有很多任务的时间安排在两者之间。有些任务很紧急,但并不重要。有些任务很重要,但并不紧急。你似乎想起了亚里士多德的名言:“我们是由我们反复做的事情构成的”,无论是拖地、花更多时间陪伴家人、按时报税,还是学习法语。
It’s Monday morning, and you have an as-yet blank schedule and a long list of tasks to complete. Some can be started only after others are finished (you can’t load the dishwasher unless it’s unloaded first), and some can be started only after a certain time (the neighbors will complain if you put the trash out on the curb before Tuesday night). Some have sharp deadlines, others can be done whenever, and many are fuzzily in between. Some are urgent, but not important. Some are important, but not urgent. “We are what we repeatedly do,” you seem to recall Aristotle saying—whether it’s mop the floor, spend more time with family, file taxes on time, learn French.
那么,该做什么?什么时候做?按照什么顺序做?你的生命正在等待着你。
So what to do, and when, and in what order? Your life is waiting.
虽然我们总能找到办法来安排每天要做的事情,但通常我们并不认为自己特别擅长——因此时间管理指南才得以经久不衰。遗憾的是,这些指南中的指导往往前后矛盾,前后矛盾。《搞定》一书倡导一种策略,即任何两分钟或更短时间的任务,只要想到就立即完成。其竞争对手的畅销书《吃掉那只青蛙!》则建议从最难的任务开始,逐渐转向越来越容易的任务。《当下习惯》则建议先安排好社交活动和休闲时间,然后用工作来填补空隙——而不是像我们经常做的那样,反过来安排。“美国心理学之父”威廉·詹姆斯断言:“没有什么比永远挂在未完成的任务上更令人疲惫的了”,但弗兰克·帕特诺伊在《等待》一书中却提出了故意不立即做事的理由。
Though we always manage to find some way to order the things we do in our days, as a rule we don’t consider ourselves particularly good at it—hence the perennial bestseller status of time-management guides. Unfortunately, the guidance we find in them is frequently divergent and inconsistent. Getting Things Done advocates a policy of immediately doing any task of two minutes or less as soon as it comes to mind. Rival bestseller Eat That Frog! advises beginning with the most difficult task and moving toward easier and easier things. The Now Habit suggests first scheduling one’s social engagements and leisure time and then filling the gaps with work—rather than the other way around, as we so often do. William James, the “father of American psychology,” asserts that “there’s nothing so fatiguing as the eternal hanging on of an uncompleted task,” but Frank Partnoy, in Wait, makes the case for deliberately not doing things right away.
每个大师都有不同的体系,很难知道该听谁的。
Every guru has a different system, and it’s hard to know who to listen to.
花时间成为一门科学
Spending Time Becomes a Science
虽然时间管理似乎与时间本身一样古老,但时间安排的科学起源于工业革命时期的机械车间。1874年,一位富有律师的儿子弗雷德里克·泰勒拒绝了哈佛大学的录取,前往费城的企业液压厂担任机械学徒。四年后,他完成了学徒期,开始在米德维尔钢铁厂工作,并在那里从车床操作员晋升为机械车间领班,最终成为总工程师。在此过程中,他逐渐意识到自己所管理的机器(以及人员)的时间并没有得到充分利用,这促使他创立了一门名为“科学管理”的学科。
Though time management seems a problem as old as time itself, the science of scheduling began in the machine shops of the industrial revolution. In 1874, Frederick Taylor, the son of a wealthy lawyer, turned down his acceptance at Harvard to become an apprentice machinist at Enterprise Hydraulic Works in Philadelphia. Four years later, he completed his apprenticeship and began working at the Midvale Steel Works, where he rose through the ranks from lathe operator to machine shop foreman and ultimately to chief engineer. In the process, he came to believe that the time of the machines (and people) he oversaw was not being used very well, leading him to develop a discipline he called “Scientific Management.”
泰勒创建了一个规划办公室,其核心是一块公告板,上面张贴着车间的日程安排,供所有人查看。公告板列出了车间里的每一台机器,显示了该机器当前正在执行的任务以及所有等待它执行的任务。泰勒的同事亨利·甘特(Henry Gantt)在此基础上发展了这一做法。他在20世纪10年代开发了甘特图,帮助组织了20世纪许多最雄心勃勃的建设项目,从胡佛大坝到州际公路系统。一个世纪过去了,甘特图仍然装饰着亚马逊、宜家和SpaceX等公司项目经理的墙壁和屏幕。
Taylor created a planning office, at the heart of which was a bulletin board displaying the shop’s schedule for all to see. The board depicted every machine in the shop, showing the task currently being carried out by that machine and all the tasks waiting for it. This practice would be built upon by Taylor’s colleague Henry Gantt, who in the 1910s developed the Gantt charts that would help organize many of the twentieth century’s most ambitious construction projects, from the Hoover Dam to the Interstate Highway System. A century later, Gantt charts still adorn the walls and screens of project managers at firms like Amazon, IKEA, and SpaceX.
泰勒和甘特将排程作为研究对象,并赋予其视觉和概念化的形式。但他们并未解决确定最佳排程的根本问题。直到几十年后,兰德公司数学家塞尔默·约翰逊在1954年发表的一篇论文中,才首次暗示这个问题可以得到解决。
Taylor and Gantt made scheduling an object of study, and they gave it visual and conceptual form. But they didn’t solve the fundamental problem of determining which schedules were best. The first hint that this problem even could be solved wouldn’t appear until several decades later, in a 1954 paper published by RAND Corporation mathematician Selmer Johnson.
约翰逊研究的场景是装订书籍,每本书都需要在一台机器上印刷,然后在另一台机器上装订。但这种双机配置最常见的例子离我们更近:洗衣服。洗衣服时,它们必须按顺序经过洗衣机和烘干机,不同批次的衣服在洗衣机和烘干机中洗涤的时间也不同。脏兮兮的一批衣服可能需要更长的洗涤时间,但烘干时间与通常相同;大量的衣服可能需要更长的烘干时间,但洗涤时间与通常相同。因此,约翰逊问道,如果你在同一天要洗几批衣服,最好的洗涤方法是什么?
The scenario Johnson examined was bookbinding, where each book needs to be printed on one machine and then bound on another. But the most common instance of this two-machine setup is much closer to home: the laundry. When you wash your clothes, they have to pass through the washer and the dryer in sequence, and different loads will take different amounts of time in each. A heavily soiled load might take longer to wash but the usual time to dry; a large load might take longer to dry but the usual time to wash. So, Johnson asked, if you have several loads of laundry to do on the same day, what’s the best way to do them?
他的答案是,你应该从找到耗时最少的一步开始——洗涤或烘干速度最快的那一批衣物。如果这最短的步骤需要洗衣机,就计划先洗这批衣物。如果需要烘干机,就计划最后洗。对剩余的衣物重复此过程,从洗涤计划的两端向中间进行。
His answer was that you should begin by finding the single step that takes the least amount of time—the load that will wash or dry the quickest. If that shortest step involves the washer, plan to do that load first. If it involves the dryer, plan to do it last. Repeat this process for the remaining loads, working from the two ends of the schedule toward the middle.
直观地看,约翰逊算法之所以有效,是因为无论你如何安排洗衣顺序,在洗衣开始时总会有一段时间洗衣机运转而烘干机不运转,而在洗衣结束时也会有一段时间烘干机运转而洗衣机不运转。通过在开始时设定最短的洗涤时间,并在结束时设定最短的烘干时间,你就能最大限度地增加重叠时间——也就是洗衣机和烘干机同时运行时。这样,你就可以将洗衣的总时间控制在绝对最短。约翰逊的分析得出了洗衣排程中第一个最优算法:从洗涤量最少的衣物开始,以洗衣篮最小的衣物结束。
Intuitively, Johnson’s algorithm works because regardless of how you sequence the loads, there’s going to be some time at the start when the washer is running but not the dryer, and some time at the end when the dryer is running but not the washer. By having the shortest washing times at the start, and the shortest drying times at the end, you maximize the amount of overlap—when the washer and dryer are running simultaneously. Thus you can keep the total amount of time spent doing laundry to the absolute minimum. Johnson’s analysis had yielded scheduling’s first optimal algorithm: start with the lightest wash, end with the smallest hamper.
除了其直接应用之外,约翰逊的论文还揭示了两个更深层次的观点:首先,调度可以用算法来表达;其次,最优调度方案是存在的。这开启了一系列浩如烟海的文献,探索着各种假设工厂的调度策略,这些工厂拥有各种可以想象到的机器数量和类型。
Beyond its immediate applications, Johnson’s paper revealed two deeper points: first, that scheduling could be expressed algorithmically, and second, that optimal scheduling solutions existed. This kicked off what has become a sprawling literature, exploring strategies for a vast menagerie of hypothetical factories with every conceivable number and kind of machines.
我们将重点关注这类文献中的一小部分:与装订书籍或洗衣不同,这部分内容涉及单台机器的调度。因为最重要的调度问题只涉及一台机器:我们自己。
We’re going to focus on a tiny subset of this literature: the part that, unlike bookbinding or laundry, deals with scheduling for a single machine. Because the scheduling problem that matters the most involves just one machine: ourselves.
处理截止日期
Handling Deadlines
在单机调度中,我们一开始就会遇到一些问题。约翰逊关于装订的工作是基于最小化两台机器完成所有作业所需的总时间。然而,在单机调度的情况下,如果我们要完成所有分配的任务,那么所有调度都需要相同的时间才能完成;顺序无关紧要。
With single-machine scheduling, we run into something of a problem right off the bat. Johnson’s work on bookbinding was based on minimizing the total time required for the two machines to complete all of their jobs. In the case of single-machine scheduling, however, if we are going to do all the tasks assigned, then all schedules will take equally long to complete; the order is irrelevant.
这是一个足够基本且违反直觉的观点,值得重复一遍。如果你只有一台机器,并且要完成所有任务,那么任何任务的排序都会花费相同的时间。
This is a sufficiently fundamental and counterintuitive point that it’s worth repeating. If you have only a single machine, and you’re going to do all of your tasks, then any ordering of the tasks will take you the same amount of time.
因此,我们在开始单机调度之前就遇到了第一课:明确你的目标。在我们知道如何记录得分之前,我们不能宣布某个调度是赢家。这在某种程度上是计算机科学中的一个主题:在制定计划之前,你必须首先选择一个指标。事实证明,我们在这里选择的指标将直接影响哪种调度方法效果最佳。
Thus we encounter the first lesson in single-machine scheduling literally before we even begin: make your goals explicit. We can’t declare some schedule a winner until we know how we’re keeping score. This is something of a theme in computer science: before you can have a plan, you must first choose a metric. And as it turns out, which metric we pick here will directly affect which scheduling approaches fare best.
紧随约翰逊的装订工作之后,第一篇关于单机调度的论文也随之发表,并提出了几个可行的指标供参考。针对每个指标,他们都发现了一个简单、最优的策略。
The first papers on single-machine scheduling followed quickly on the heels of Johnson’s bookbinding work and offered several plausible metrics to consider. For each metric, they discovered a simple, optimal strategy.
例如,任务通常都有一个截止日期,而任务的延迟程度则是指其逾期时间。因此,我们可以将一组任务的“最大延迟”视为超出截止日期最久的任务的延迟程度——你的雇主在绩效评估中可能会关注这类事情。(或者,在零售或服务行业中,你的客户可能也会关注这类事情,其中“最大延迟”任务对应于等待时间最长的客户。)
It is of course common, for instance, for tasks to have a due date, with the lateness of a task being how far it has gone overdue. So we can think of the “maximum lateness” of a set of tasks as the lateness of whatever task has gone furthest past its due date—the kind of thing your employer might care about in a performance review. (Or what your customers might care about in a retail or service setting, where the “maximally late” task corresponds to the customer subjected to the longest wait time.)
如果您关心的是最大程度地减少迟到,那么最好的策略是从最早截止的任务开始,然后逐步完成最后截止的任务。这种策略称为最早截止日,相当直观。(例如,在服务业中,每个到达顾客的“截止日”实际上就是他们进门的那一刻,这只是意味着按照到达的顺序为顾客提供服务。)但它的一些含义令人惊讶。例如,完成每个任务需要多长时间完全无关紧要:它不会改变计划,所以实际上您甚至不需要知道。重要的是任务何时截止。
If you’re concerned with minimizing maximum lateness, then the best strategy is to start with the task due soonest and work your way toward the task due last. This strategy, known as Earliest Due Date, is fairly intuitive. (For instance, in a service-sector context, where each arriving patron’s “due date” is effectively the instant they walk in the door, it just means serving customers in order of arrival.) But some of its implications are surprising. For example, how long each task will take to complete is entirely irrelevant: it doesn’t change the plan, so in fact you don’t even need to know. All that matters is when the tasks are due.
您可能已经在使用最早截止日期来处理工作量,在这种情况下,您可能不需要计算机科学来告诉您这是一个明智的策略。然而,您可能不知道的是,这是最佳策略。更准确地说,如果您只关注一个特定的指标:减少最大迟交率,那么它是最佳策略。但是,如果这不是您的目标,那么其他策略可能更适用。
You might already be using Earliest Due Date to tackle your workload, in which case you probably don’t need computer science to tell you that it’s a sensible strategy. What you may not have known, though, is that it’s the optimal strategy. More precisely, it is optimal assuming that you’re only interested in one metric in particular: reducing your maximum lateness. If that’s not your goal, however, then another strategy might be more applicable.
以冰箱为例。如果你是众多社区支持农业 (CSA) 订阅者之一,那么每隔一两周就会有大量新鲜农产品一次性送到你家门口。每种农产品的腐烂日期都不同——因此,按照其腐烂时间表的先后顺序,在最早到期日之前食用它们似乎是一个合理的起点。然而,这并不是故事的结束。最早到期日是减少最大逾期率的最佳选择,这意味着它将最大限度地降低你必须吃到的腐烂程度最严重的农产品的腐烂程度;这可能不是最令人垂涎的食用标准。
For instance, consider the refrigerator. If you’re one of the many people who have a community-supported agriculture (CSA) subscription, then every week or two you’ve got a lot of fresh produce coming to your doorstep all at once. Each piece of produce is set to spoil on a different date—so eating them by Earliest Due Date, in order of their spoilage schedule, seems like a reasonable starting point. It’s not, however, the end of the story. Earliest Due Date is optimal for reducing maximum lateness, which means it will minimize the rottenness of the single most rotten thing you’ll have to eat; that may not be the most appetizing metric to eat by.
也许我们更想尽量减少变质食物的数量。一种名为“摩尔算法”的策略能帮我们找到最佳方案。摩尔算法的出发点与“最早到期日”类似——按照变质日期的顺序,先最早的,一次一个地安排食物。然而,一旦发现下一份食物似乎无法及时食用,我们就会停下来,回顾一下已经计划好的餐食,然后扔掉最大的那一份(也就是需要最多天才能吃完的那一份)。例如,这可能意味着放弃一个需要吃半打才能吃完的西瓜;即使不尝试,也意味着要更快地吃完接下来的所有食物。然后,我们重复这个模式,按变质日期排列食物,并在任何时间落后时,扔掉已经安排好的最大的那一份。一旦剩下的所有食物都能按照变质日期的顺序吃完,且不会变质,我们的计划就制定好了。
Maybe instead we want to minimize the number of foods that spoil. Here a strategy called Moore’s Algorithm gives us our best plan. Moore’s Algorithm says that we start out just like with Earliest Due Date—by scheduling out our produce in order of spoilage date, earliest first, one item at a time. However, as soon as it looks like we won’t get to eating the next item in time, we pause, look back over the meals we’ve already planned, and throw out the biggest item (that is, the one that would take the most days to consume). For instance, that might mean forgoing the watermelon that would take a half dozen servings to eat; not even attempting it will mean getting to everything that follows a lot sooner. We then repeat this pattern, laying out the foods by spoilage date and tossing the largest already scheduled item any time we fall behind. Once everything that remains can be eaten in order of spoilage date without anything spoiling, we’ve got our plan.
摩尔算法可以最大限度地减少你需要丢弃的物品数量。当然,你也可以把食物堆肥,捐赠给当地的食物银行,或者送给邻居。在工业或官僚环境中,你不能简单地放弃一个项目,但你最关心的仍然是延期项目的数量——而不是严重程度——摩尔算法对这些延期任务的处理方式同样漠不关心。任何从你日程表主要部分中被淘汰的项目都可以在最后完成,顺序不限;这并不重要,因为它们都已经延期了。
Moore’s Algorithm minimizes the number of items you’ll need to throw away. Of course, you’re also welcome to compost the food, donate it to the local food bank, or give it to your neighbor. In an industrial or bureaucratic context where you can’t simply discard a project, but in which the number—rather than the severity—of late projects is still your biggest concern, Moore’s Algorithm is just as indifferent about how those late tasks are handled. Anything booted from the main portion of your schedule can get done at the very end, in any order; it doesn’t matter, as they’re all already late.
完成任务
Getting Things Done
把难事当易事去做,把大事当小事去做。
Do the difficult things while they are easy and do the great things while they are small.
—老子
—LAO TZU
有时候,截止日期并非我们最关心的事情,我们只想尽快完成尽可能多的事情。事实证明,将这个看似简单的愿望转化为明确的日程安排指标比听起来要难得多。
Sometimes due dates aren’t our primary concern and we just want to get stuff done: as much stuff, as quickly as possible. It turns out that translating this seemingly simple desire into an explicit scheduling metric is harder than it sounds.
一种方法是采取局外人的视角。我们已经注意到,在单机调度中,我们所做的一切都无法改变完成所有任务所需的时间——但如果每个任务都代表一位等待的客户,那么就有办法尽可能少地占用他们的时间。想象一下,从周一早上开始,你的日程表上列着一个为期四天的项目和一个为期一天的项目。如果你在周四下午(已过去 4 天)交付大项目,然后在周五下午(已过去 5 天)交付小项目,那么客户总共要等待 4 + 5 = 9 天。但是,如果你颠倒顺序,你可以在周一完成小项目,在周五完成大项目,客户总共只等待 1 + 5 = 6 天。无论哪种方式,对你来说都是一个完整的工作周,但现在你为客户节省了三天的总时间。调度理论家将此指标称为“完成时间总和”。
One approach is to take an outsider’s perspective. We’ve noted that in single-machine scheduling, nothing we do can change how long it will take us to finish all of our tasks—but if each task, for instance, represents a waiting client, then there is a way to take up as little of their collective time as possible. Imagine starting on Monday morning with a four-day project and a one-day project on your agenda. If you deliver the bigger project on Thursday afternoon (4 days elapsed) and then the small one on Friday afternoon (5 days elapsed), the clients will have waited a total of 4 + 5 = 9 days. If you reverse the order, however, you can finish the small project on Monday and the big one on Friday, with the clients waiting a total of only 1 + 5 = 6 days. It’s a full workweek for you either way, but now you’ve saved your clients three days of their combined time. Scheduling theorists call this metric the “sum of completion times.”
最小化完成时间的总和会得到一个非常简单的最优算法,称为最短处理时间:始终尽可能快地完成任务。
Minimizing the sum of completion times leads to a very simple optimal algorithm called Shortest Processing Time: always do the quickest task you can.
即使没有不耐烦的客户对你的工作念念不忘,“最短处理时间”也能帮你搞定一切。(这或许与《搞定一切》中的建议相符,只要任务少于两分钟,就立即执行,这并不奇怪。)同样,你无法改变工作所需的总时间,但“最短处理时间”可以尽快减少未完成任务的数量,让你安心。它的完成时间总和指标可以用另一种方式来表达:这就像首先关注如何缩短待办事项清单的长度。如果每件未完成的事情都像一根芒刺,那么快速完成最简单的任务可能会给你带来一些安慰。
Even if you don’t have impatient clients hanging on every job, Shortest Processing Time gets things done. (Perhaps it’s no surprise that it is compatible with the recommendation in Getting Things Done to immediately perform any task that takes less than two minutes.) Again, there’s no way to change the total amount of time your work will take you, but Shortest Processing Time may ease your mind by shrinking the number of outstanding tasks as quickly as possible. Its sum-of-completion-times metric can be expressed another way: it’s like focusing above all on reducing the length of your to-do list. If each piece of unfinished business is like a thorn in your side, then racing through the easiest items may bring some measure of relief.
当然,并非所有未完成的事情都是一样的。扑灭厨房里真正的火可能应该比给客户发一封快速电子邮件“灭火”要早,即使前者花费的时间更长一些。在日程安排中,这种重要性差异体现在一个称为权重的变量中。当你浏览待办事项清单时,这个权重可能感觉很直观——完成每项任务后你肩上的负担减轻了。一项任务的完成时间表明你背负这个负担的时间长度,因此最小化加权完成时间的总和(即每个任务的持续时间乘以其权重)意味着在你完成整个议程时最大限度地减少你的总压力。
Of course, not all unfinished business is created equal. Putting out an actual fire in the kitchen should probably be done before “putting out a fire” with a quick email to a client, even if the former takes a bit longer. In scheduling, this difference of importance is captured in a variable known as weight. When you’re going through your to-do list, this weight might feel literal—the burden you get off your shoulders by finishing each task. A task’s completion time shows how long you carry that burden, so minimizing the sum of weighted completion times (that is, each task’s duration multiplied by its weight) means minimizing your total oppression as you work through your entire agenda.
实现该目标的最佳策略是对最短处理时间策略的简单修改:将每个任务的权重除以其完成所需的时间,然后按单位时间重要性从高到低的顺序进行(如果你愿意,可以称之为“密度”,继续使用权重的比喻)。虽然为每一项日常任务分配重要性可能很难,但这个策略仍然提供了一个不错的经验法则:只有当任务的重要性是其两倍时,才优先考虑耗时两倍的任务。
The optimal strategy for that goal is a simple modification of Shortest Processing Time: divide the weight of each task by how long it will take to finish, and then work in order from the highest resulting importance-per-unit-time (call it “density” if you like, to continue the weight metaphor) to the lowest. And while it might be hard to assign a degree of importance to each one of your daily tasks, this strategy nonetheless offers a nice rule of thumb: only prioritize a task that takes twice as long if it’s twice as important.
在商业环境中,“权重”很容易转化为每项任务能带来的收入。因此,将报酬除以工期的概念,就等于为每项任务分配一个小时费率。(如果你是顾问或自由职业者,这项工作实际上可能已经为你完成了:只需将每个项目的费用除以其规模,然后按照小时费率从高到低的顺序计算即可。)有趣的是,这种加权策略也出现在动物觅食研究中,坚果和浆果取代了金钱。动物为了最大限度地提高从食物中积累能量的速度,应该按照其热量与获取和食用所需时间的比率来获取食物——而且看起来确实如此。
In business contexts, “weight” might easily be translated to the amount of money each task will bring in. The notion of dividing reward by duration translates, therefore, to assigning each task an hourly rate. (If you’re a consultant or freelancer, that might in effect already be done for you: simply divide each project’s fee by its size, and work your way from the highest hourly rate to the lowest.) Interestingly, this weighted strategy also shows up in studies of animal foraging, with nuts and berries taking the place of dollars and cents. Animals, seeking to maximize the rate at which they accumulate energy from food, should pursue foods in order of the ratio of their caloric energy to the time required to get and eat them—and indeed appear to do so.
当同样的原则应用于债务而非收入时,就会产生一种盈利策略,被称为“债务雪崩”。这种债务削减策略要求完全忽略债务的数量和规模,只将资金用于偿还利率最高的债务。这相当于在单位时间内按重要性排序完成工作。这种策略能够尽快减轻你的总债务负担。
When applied to debts rather than incomes, the same principle yields a strategy for getting in the black that’s come to be called the “debt avalanche.” This debt-reduction strategy says to ignore the number and size of your debts entirely, and simply funnel your money toward the debt with the single highest interest rate. This corresponds rather neatly to working through jobs in order of importance per unit time. And it’s the strategy that will reduce the total burden of your debt as quickly as possible.
另一方面,如果你更关心的是减少债务数量而不是债务金额——例如,如果大量账单和催收电话的麻烦比利率差异更重要——那么你又回到了不加权的“只管把事情做完”的最短处理时间原则,先偿还最小的债务,只是为了把它们解决掉。在债务削减圈子里,这种方法被称为“滚雪球”。在实践中,人们应该优先降低债务金额还是债务数量,这在大众媒体和经济学研究中仍然是一个激烈的争论话题。
If, on the other hand, you’re more concerned with reducing the number of debts than the amount of debt—if, for instance, the hassle of numerous bills and collection phone calls is a bigger deal than the difference in interest rates—then you’re back to the unweighted, “just get stuff done” flavor of Shortest Processing Time, paying off the smallest debts first simply to get them out of the way. In debt-reduction circles, this approach is known as the “debt snowball.” Whether people, in practice, ought to prioritize lowering the dollar amount of their debts or the quantity of them remains an active controversy, both in the popular press as well as in economics research.
选择我们的问题
Picking Our Problems
这让我们回到了最初讨论单机调度的话题。俗话说:“戴一块手表的人知道现在几点;戴两块手表的人永远无法确定。” 计算机科学可以为单机调度中各种指标提供最优算法,但选择哪个指标取决于我们自己。很多时候,我们要决定要解决什么问题。
This brings us back to the note on which we began our discussion of single-machine scheduling. It’s said that “a man with one watch knows what time it is; a man with two watches is never sure.” Computer science can offer us optimal algorithms for various metrics available in single-machine scheduling, but choosing the metric we want to follow is up to us. In many cases, we get to decide what problem we want to be solving.
这为我们重新思考拖延症——时间管理的经典病态——提供了一种彻底的视角。我们通常认为它是一种错误的算法。如果它恰恰相反呢?如果它是针对错误问题的最佳解决方案呢?
This offers a radical way to rethink procrastination, the classic pathology of time management. We typically think of it as a faulty algorithm. What if it’s exactly the opposite? What if it’s an optimal solution to the wrong problem?
《X档案》有一集讲的是,主人公穆德卧床不起,眼看就要被一个患有强迫症的吸血鬼吞噬,为了自卫,他把一袋葵花籽撒在了地上。吸血鬼无力抵抗这种冲动,只好弯腰一粒一粒地捡起来,结果太阳升起来了,穆德还没来得及被他吃掉。计算机科学家把这种攻击称为“ping攻击”或“拒绝服务攻击”:给系统分配大量琐碎的任务,而重要的事情却在混乱中被遗忘。
There’s an episode of The X-Files where the protagonist Mulder, bedridden and about to be consumed by an obsessive-compulsive vampire, spills a bag of sunflower seeds on the floor in self-defense. The vampire, powerless against his compulsion, stoops to pick them up one by one, and ultimately the sun rises before he can make a meal of Mulder. Computer scientists would call this a “ping attack” or a “denial of service” attack: give a system an overwhelming number of trivial things to do, and the important things get lost in the chaos.
我们通常把拖延症与懒惰或逃避行为联系在一起,但它也同样容易出现在那些认真热情地试图尽快完成任务的人(或电脑,或吸血鬼)身上。例如,在宾夕法尼亚州立大学的戴维·罗森鲍姆(David Rosenbaum)于2014年领导的一项研究中,参与者被要求将两个沉重的水桶中的其中一个搬到走廊的另一端。其中一个水桶就在参与者身边,另一个则在走廊的中途。令实验者惊讶的是,参与者会立即拿起靠近他们的水桶,一路拖着它走下去——途中会经过另一个水桶,而他们本来只需搬运一小部分距离。正如研究人员所写,“这种看似非理性的选择反映了一种预先拖延的倾向,我们引入这个术语来指代加速完成子目标的行为,即使付出额外的体力劳动也是如此。”拖延一个重要项目,转而处理各种琐事,同样可以被理解为“加速子目标的完成”——换句话说,拖延者正在(以最优的方式!)采取行动,尽可能快地减少他们脑海中未完成的任务数量。这并不是说他们完成任务的策略不好,而是他们有一个很棒的策略,但衡量标准却错了。
We typically associate procrastination with laziness or avoidance behavior, but it can just as easily spring up in people (or computers, or vampires) who are trying earnestly and enthusiastically to get things done as quickly as possible. In a 2014 study led by Penn State’s David Rosenbaum, for example, participants were asked to bring either one of two heavy buckets to the opposite end of a hallway. One of the buckets was right next to the participant; the other was partway down the hall. To the experimenters’ surprise, people immediately picked up the bucket near them and lugged it all the way down—passing the other bucket on the way, which they could have carried a fraction of the distance. As the researchers write, “this seemingly irrational choice reflected a tendency to pre-crastinate, a term we introduce to refer to the hastening of subgoal completion, even at the expense of extra physical effort.” Putting off work on a major project by attending instead to various trivial matters can likewise be seen as “the hastening of subgoal completion”—which is another way of saying that procrastinators are acting (optimally!) to reduce as quickly as possible the number of outstanding tasks on their minds. It’s not that they have a bad strategy for getting things done; they have a great strategy for the wrong metric.
使用电脑工作,在我们有意识地、慎重地安排我们的时间安排指标时,会带来额外的风险:用户界面可能会巧妙地(或不那么巧妙地)将其自身的指标强加于我们。例如,现代智能手机用户已经习惯于看到应用程序图标上方悬浮着“徽章”,红底白字的不祥数字准确地指示着每个特定应用程序希望我们完成的任务数量。如果电子邮件收件箱里高声显示未读邮件的数量,那么所有邮件都隐含地被赋予了同等的权重。那么,我们为了尽快降低这个数字,将未加权的最短处理时间算法应用于这个问题——先处理所有最简单的邮件,将最难的邮件推迟到最后——这能怪我们吗?
Working on a computer brings with it an additional hazard when it comes to being conscious and deliberate about our scheduling metrics: the user interface may subtly (or not so subtly) force its own metric upon us. A modern smartphone user, for instance, is accustomed to seeing “badges” hovering over application icons, ominous numbers in white-on-red signaling exactly how many tasks each particular app expects us to complete. If it’s an email inbox blaring the figure of unread messages, then all messages are implicitly being given equal weight. Can we be blamed, then, for applying the unweighted Shortest Processing Time algorithm to the problem—dealing with all of the easiest emails first and deferring the hardest ones till last—to lower this numeral as quickly as possible?
生于度量,死于度量。如果所有任务确实同等重要,那这正是我们应该做的。但如果我们不想成为琐碎事务的奴隶,就需要采取措施来实现这一目标。首先要确保我们正在解决的单机问题正是我们想要解决的问题。(就应用徽章而言,如果我们无法让它们反映我们的实际优先级,也无法克服想要最大程度地减少任何抛在眼前的数字的冲动,那么或许下一个最佳选择就是关闭徽章。)
Live by the metric, die by the metric. If all tasks are indeed of equal weight, then that’s exactly what we should be doing. But if we don’t want to become slaves to minutiae, then we need to take measures toward that end. This starts with making sure that the single-machine problem we’re solving is the one we want to be solving. (In the case of app badges, if we can’t get them to reflect our actual priorities, and can’t overcome the impulse to optimally reduce any numerical figure thrown in our face, then perhaps the next best thing is simply to turn the badges off.)
不仅要专注于完成任务,更要专注于完成重要的任务——在每一刻都尽可能地做最重要的工作——这听起来像是治愈拖延症的灵丹妙药。但事实证明,即使这样也不够。一群计算机调度专家将以最戏剧性的方式体验到这一教训:在火星表面,全世界都在注视着他们。
Staying focused not just on getting things done but on getting weighty things done—doing the most important work you can at every moment—sounds like a surefire cure for procrastination. But as it turns out, even that is not enough. And a group of computer scheduling experts would encounter this lesson in the most dramatic way imaginable: on the surface of Mars, with the whole world watching.
优先级反转和优先约束
Priority Inversion and Precedence Constraints
1997 年夏天,人类有很多值得庆祝的事情。有史以来第一次,一辆火星探测车在火星表面行驶。耗资 1.5 亿美元的“火星探路者”号航天器加速到每小时 26,000 公里,穿越 4.9 亿公里的空旷太空,最终借助航天级安全气囊,成功降落在火星岩石遍布的红色表面。
It was the summer of 1997, and humanity had a lot to celebrate. For the first time ever, a rover was navigating the surface of Mars. The $150 million Mars Pathfinder spacecraft had accelerated to a speed of 16,000 miles per hour, traveled across 309 million miles of empty space, and landed with space-grade airbags onto the rocky red Martian surface.
现在却在拖延。
And now it was procrastinating.
回到地球,喷气推进实验室 (JPL) 的工程师们既担心又困惑。探路者号的最高优先级任务(将数据移入和移出其“信息总线”)神秘地被忽略了,因为机器人把时间浪费在了中等重要的任务上。这是怎么回事?难道机器人自己都不知道吗?
Back on Earth, Jet Propulsion Laboratory (JPL) engineers were both worried and stumped. Pathfinder’s highest priority task (to move data into and out of its “information bus”) was mysteriously being neglected as the robot whiled away its time on tasks of middling importance. What was going on? Didn’t the robot know any better?
突然,探路者号记录到信息总线长时间未得到处理,由于缺乏更巧妙的补救措施,它启动了完全重启,导致任务组损失了大半天的时间。大约一天后,同样的事情再次发生。
Suddenly Pathfinder registered that the information bus hadn’t been dealt with for an unacceptably long time, and, lacking a subtler recourse, initiated a complete restart, costing the mission the better part of a day’s work. A day or so later, the same thing happened again.
经过不懈努力,JPL团队终于成功重现并诊断出问题所在。罪魁祸首是一种名为“优先级反转”的经典调度风险。优先级反转是指低优先级任务占用系统资源(比如访问数据库)执行某项工作,但在执行过程中被计时器中断,计时器暂停任务并调用系统调度程序。调度程序启动了一个高优先级任务,但由于数据库已被占用,该任务无法运行。于是,调度程序沿着优先级列表向下移动,运行各种未被阻塞的中优先级任务,而不是高优先级任务(已被阻塞),也不是阻塞它的低优先级任务(排在所有中优先级任务之后)。在这些噩梦般的场景中,系统的最高优先级有时会被忽略很长一段时间。*
Working feverishly, the JPL team finally managed to reproduce and then diagnose the behavior. The culprit was a classic scheduling hazard called priority inversion. What happens in a priority inversion is that a low-priority task takes possession of a system resource (access to a database, let’s say) to do some work, but is then interrupted partway through that work by a timer, which pauses it and invokes the system scheduler. The scheduler tees up a high-priority task, but it can’t run because the database is occupied. And so the scheduler moves down the priority list, running various unblocked medium-priority tasks instead—rather than the high-priority one (which is blocked), or the low-priority one that’s blocking it (which is stuck in line behind all the medium-priority work). In these nightmarish scenarios, the system’s highest priority can sometimes be neglected for arbitrarily long periods of time.*
喷气推进实验室(JPL)的工程师们一旦将探路者号的问题认定为优先级反转,他们就会编写修复程序,并将新代码传遍数百万英里之外的探路者号。他们传遍整个太阳系的解决方案是什么?优先级继承。如果发现一个低优先级任务阻塞了高优先级资源,那么,这个低优先级任务就会突然暂时成为系统中优先级最高的任务,“继承”它所阻塞任务的优先级。
Once JPL engineers had identified the Pathfinder problem as a case of priority inversion, they wrote up a fix and beamed the new code across millions of miles to Pathfinder. What was the solution they sent flying across the solar system? Priority inheritance. If a low-priority task is found to be blocking a high-priority resource, well, then all of a sudden that low-priority task should momentarily become the highest-priority thing on the system, “inheriting” the priority of the thing it’s blocking.
喜剧演员米奇·赫德伯格(Mitch Hedberg)回忆起有一次“我在赌场,正忙着自己的事情,突然有个家伙走过来对我说:‘你得挪挪身子,你挡住了消防出口。’就好像着火了,我跑不了似的。” 保镖的论点是优先级倒置;赫德伯格的反驳是优先级继承。赫德伯格漫不经心地在逃亡人群面前徘徊,这让他低优先级的徘徊比他们优先级高的逃命更重要——但前提是他继承了他们的优先级。而冲上来的人群总有办法让一个人很快继承他们的优先级。正如赫德伯格所解释的那样:“如果你是易燃的,而且有腿,你就永远挡不住消防出口。”
The comedian Mitch Hedberg recounts a time when “I was at a casino, I was minding my own business, and this guy came up and said, ‘You’re gonna have to move, you’re blocking the fire exit.’ As though if there was a fire, I wasn’t gonna run.” The bouncer’s argument was priority inversion; Hedberg’s rebuttal was priority inheritance. Hedberg lounging casually in front of a fleeing mob puts his low-priority loitering ahead of their high-priority running for their lives—but not if he inherits their priority. And an onrushing mob has a way of making one inherit their priority rather quickly. As Hedberg explains, “If you’re flammable and have legs, you are never blocking a fire exit.”
这里的寓意是,热爱完成任务并不足以避免日程安排中的陷阱,热爱完成重要的事情也一样。如果一门心思、目光短浅地致力于一丝不苟地完成最重要的事情,那么可能会导致显而易见的拖延症。就像汽车空转的轮胎一样,想要立即取得进展的愿望正是人们陷入困境的原因。据称歌德曾宣称:“最重要的事情绝不能受制于最不重要的事情。”这句话听起来很有智慧,但有时却并非如此。有时,最重要的事情只有在最不重要的事情完成之后才能完成,所以别无选择,只能将那件不重要的事情视为与它所阻碍的事情同等重要。
The moral here is that a love of getting things done isn’t enough to avoid scheduling pitfalls, and neither is a love of getting important things done. A commitment to fastidiously doing the most important thing you can, if pursued in a head-down, myopic fashion, can lead to what looks for all the world like procrastination. As with a car spinning its tires, the very desire to make immediate progress is how one gets stuck. “Things which matter most must never be at the mercy of things which matter least,” Goethe allegedly proclaimed; but while that has the ring of wisdom about it, sometimes it’s just not true. Sometimes that which matters most cannot be done until that which matters least is finished, so there’s no choice but to treat that unimportant thing as being every bit as important as whatever it’s blocking.
当某项任务必须等到另一项任务完成后才能开始执行时,调度理论家称之为“优先约束”。对于运筹学专家劳拉·艾伯特·麦克莱来说,牢记这一原则在她自己的家中多次发挥了重要作用。“如果你能看到这些事情,会非常有帮助。当然,要照顾三个孩子,一天下来需要做很多安排……孩子们不先吃早餐,我们就出不了门;如果我没记得给他们勺子,他们就不能先吃早餐。有时候,你会忘记一些非常简单的事情,结果耽误了所有事情。就调度算法而言,仅仅知道它是什么,并让它保持运转,就非常有帮助。这就是我每天完成任务的方法。”
When a certain task can’t be started until another one is finished, scheduling theorists call that a “precedence constraint.” For operations research expert Laura Albert McLay, explicitly remembering this principle has made the difference on more than one occasion in her own household. “It can be really helpful if you can see these things. Of course, getting through the day with three kids, there’s a lot of scheduling.… We can’t get out the door unless the kids get breakfast first, and they can’t get breakfast first if I don’t remember to give them a spoon. Sometimes there’s something very simple that you forget that just delays everything. In terms of scheduling algorithms, just knowing what [that] is, and keeping that moving, is incredibly helpful. That’s how I get things done every day.”
1978年,日程安排研究员Jan Karel Lenstra在帮助他的朋友Gene搬进伯克利的新家时,运用了同样的原则。“Gene推迟了一件必须先完成的事情,才能开始另一件紧急的事情。” Lenstra回忆道,他们需要归还一辆货车,但需要用这辆车归还一件设备,而需要这件设备来修理公寓里的某个东西。公寓的修理并不紧急(因此被推迟了),但归还货车的任务却显得更加紧急。Lenstra说:“我向他解释说,前一项任务应该被视为更加紧急。” 虽然Lenstra是日程安排理论的核心人物,因此完全有资格向他的朋友提出这个建议,但这却带来了一个特别讽刺的后果。这是一个典型的由优先约束导致优先级倒置的案例。而二十世纪最伟大的优先约束专家,或许正是他的朋友Eugene “Gene” Lawler。
In 1978, scheduling researcher Jan Karel Lenstra was able to use the same principle while helping his friend Gene move into a new house in Berkeley. “Gene was postponing something that had to be finished before we could start something else which was urgent.” As Lenstra recalls, they needed to return a van, but needed the van to return a piece of equipment, but needed the equipment to fix something in the apartment. The apartment fix didn’t feel urgent (hence its postponement), but the van return did. Says Lenstra, “I explained to him that the former task should be considered even more urgent.” While Lenstra is a central figure in scheduling theory, and thus was well positioned to give this advice to his friend, it came with a particularly delicious irony. This was a textbook case of priority inversion caused by precedence constraints. And arguably the twentieth century’s single greatest expert on precedence constraints was none other than his friend, Eugene “Gene” Lawler.
减速带
The Speed Bump
劳勒一生大部分时间都在思考如何最高效地完成一系列任务,他的职业生涯可谓曲折离奇,耐人寻味。他先在佛罗里达州立大学学习数学,后于1954年进入哈佛大学攻读研究生学位,但未获得博士学位便辍学。在法学院、军队以及(颇具主题性的)机械车间工作一段时间后,他于1958年回到哈佛大学,获得博士学位并在密歇根大学任职。1969年,他在休假期间访问伯克利,在一场臭名昭著的越南战争抗议活动中被捕。次年,他成为伯克利大学教员,并在那里赢得了计算机科学系“社会良知”的美誉。1994年劳勒去世后,美国计算机协会以他的名字设立了一个奖项,以表彰那些展现计算机科学人道主义潜力的人士。
Considering he spent much of his life thinking about how to most efficiently complete a sequence of tasks, Lawler took an intriguingly circuitous route to his own career. He studied mathematics at Florida State University before beginning graduate work at Harvard in 1954, though he left before finishing a doctorate. After time in law school, the army, and (thematically enough) working in a machine shop, he went back to Harvard in 1958, finishing his PhD and taking a position at the University of Michigan. Visiting Berkeley on sabbatical in 1969, he was arrested at a notorious Vietnam War protest. He became a member of the faculty at Berkeley the following year, and acquired a reputation there for being “the social conscience” of the computer science department. After his death in 1994, the Association for Computing Machinery established an award in Lawler’s name, honoring people who demonstrate the humanitarian potential of computer science.
劳勒对优先约束的首次研究表明,处理这些约束相当容易。例如,以“最早截止日期”算法为例,该算法可以最小化一组任务的最大延迟时间。如果你的任务有优先约束,事情就会变得更加棘手——如果某些任务在其他任务完成之前无法开始,你就不能简单地按照截止日期的顺序推进。但在1968年,劳勒证明,只要你按照倒序构建时间表,这就不会有问题:只考虑其他任务不依赖的任务,并将截止日期最晚的任务放在时间表的末尾。然后只需重复此过程,同样,在每一步中只考虑那些没有其他(尚未安排的)任务作为先决条件所依赖的任务。
Lawler’s first investigation into precedence constraints suggested that they could be handled quite easily. For instance, take the Earliest Due Date algorithm that minimizes the maximum lateness of a set of tasks. If your tasks have precedence constraints, that makes things trickier—you can’t just plow forward in order of due date if some tasks can’t be started until others are finished. But in 1968, Lawler proved that this is no trouble as long as you build the schedule back to front: look only at the tasks that no other tasks depend on, and put the one with the latest due date at the end of the schedule. Then simply repeat this process, again considering at each step only those tasks that no other (as-yet unscheduled) tasks depend upon as a prerequisite.
但随着劳勒对优先约束的深入研究,他发现了一些奇怪的现象。正如我们所见,如果你想尽快从待办事项列表中划掉尽可能多的事项,最短处理时间算法是最优策略。但如果你的某些任务有优先约束,那么最短处理时间算法就无法通过简单或明显的调整来适应这种情况。尽管这看起来像是一个基本的调度问题,但劳勒和其他研究人员似乎都无法找到有效的解决方法。
But as Lawler looked more deeply into precedence constraints, he found something curious. The Shortest Processing Time algorithm, as we saw, is the optimal policy if you want to cross off as many items as quickly as possible from your to-do list. But if some of your tasks have precedence constraints, there isn’t a simple or obvious tweak to Shortest Processing Time to adjust for that. Although it looked like an elementary scheduling problem, neither Lawler nor any other researcher seemed to be able to find an efficient way to solve it.
事实上,情况比这还要糟糕得多。劳勒本人很快就会发现,这个问题属于大多数计算机科学家认为没有有效解决方案的范畴——也就是该领域所谓的“棘手问题”。*调度理论的第一个障碍最终变成了一堵砖墙。
In fact, it was much worse than this. Lawler himself would soon discover that this problem belongs to a class that most computer scientists believe has no efficient solution—it’s what the field calls “intractable.”* Scheduling theory’s first speed bump turned out to be a brick wall.
正如我们在“三重或无”情景中看到的那样,最优停止理论对此没有明确的解释,并非所有能够正式表述的问题都有答案。在调度中,根据定义,每组任务和约束都有一些最佳的调度方案,因此调度问题本身并非无法解答——但可能只是没有一种简单的算法能够在合理的时间内找到最优调度方案。
As we saw with the “triple or nothing” scenario for which optimal stopping theory has no sage words, not every problem that can be formally articulated has an answer. In scheduling, it’s clear by definition that every set of tasks and constraints has some schedule that’s the best, so scheduling problems aren’t unanswerable, per se—but it may simply be the case that there’s no straightforward algorithm that can find you the optimal schedule in a reasonable amount of time.
这让像劳勒和伦斯特拉这样的研究人员不禁思考一个问题:究竟有多少调度问题是难以解决的?塞尔默·约翰逊的装订论文开启了调度理论的二十年后,对单个解决方案的探索即将成为一项更为宏大、更为雄心勃勃的任务:绘制调度理论的全貌。
This led researchers like Lawler and Lenstra to an irresistible question. Just what proportion of scheduling problems was intractable, anyway? Twenty years after scheduling theory was kick-started by Selmer Johnson’s bookbinding paper, the search for individual solutions was about to become something much grander and more ambitious by far: a quest to map the entire landscape of scheduling theory.
研究人员发现,即使是对调度问题进行最细微的调整,也常常会使其跨越易处理与难处理之间微妙且不规则的界限。例如,当所有延迟任务(或烂水果)的价值相同时,摩尔算法会最小化延迟任务(或烂水果)的数量——但如果某些任务比其他任务更重要,问题就会变得难以处理,并且没有任何算法能够轻易地提供最优调度方案。同样,必须等到某个时间才能开始执行某些任务,这使得几乎所有我们原本有有效解决方案的调度问题都变成了难以处理的问题。在垃圾收集前一天晚上才可以把垃圾扔出去或许是一条合理的市政法规,但它会让你的日程安排一头栽进难以处理的困境。
What the researchers found was that even the subtlest change to a scheduling problem often tips it over the fine and irregular line between tractable and intractable. For example, Moore’s Algorithm minimizes the number of late tasks (or rotten fruits) when they’re all of equal value—but if some are more important than others, the problem becomes intractable and no algorithm can readily provide the optimal schedule. Likewise, having to wait until a certain time to start some of your tasks makes nearly all of the scheduling problems for which we otherwise have efficient solutions into intractable problems. Not being able to put out the trash until the night before collection might be a reasonable municipal bylaw, but it will send your calendar headlong into intractability.
排程理论的边界划分至今仍在继续。最近的一项调查显示,大约7%的问题状态仍然未知,排程仍是未知领域。然而,在我们已知的93%的问题中,情况却不容乐观:只有9%的问题可以有效解决,其余84%的问题已被证明难以解决。*换句话说,大多数排程问题都没有现成的解决方案。如果试图完美地管理你的日程安排让你感到不知所措,也许那是因为它确实如此。尽管如此,我们讨论过的算法通常是解决这些难题的起点——即使不是完美的,至少也达到了预期的效果。
The drawing of the borders of scheduling theory continues to this day. A recent survey showed that the status of about 7% of all problems is still unknown, scheduling’s terra incognita. Of the 93% of the problems that we do understand, however, the news isn’t great: only 9% can be solved efficiently, and the other 84% have been proven intractable.* In other words, most scheduling problems admit no ready solution. If trying to perfectly manage your calendar feels overwhelming, maybe that’s because it actually is. Nonetheless, the algorithms we have discussed are often the starting point for tackling those hard problems—if not perfectly, then at least as well as can be expected.
放下一切:先发制人与不确定性
Drop Everything: Preemption and Uncertainty
种一棵树最好的时间是二十年前,其次是现在。
The best time to plant a tree is twenty years ago. The second best time is now.
-谚语
—PROVERB
到目前为止,我们只考虑了导致调度困难的因素。但有一个机制可以使其变得更容易:能够中途停止一个任务并切换到另一个任务。这个特性,即“抢占”,最终极大地改变了游戏规则。
So far we have considered only factors that make scheduling harder. But there is one twist that can make it easier: being able to stop one task partway through and switch to another. This property, “preemption,” turns out to change the game dramatically.
最小化最大迟到时间(例如在咖啡店为顾客服务)或最小化完成时间总和(例如快速缩短待办事项列表)如果某些任务直到特定时间才能开始,那么它们都会变得难以处理。但是,一旦允许抢占,它们就会恢复有效的解决方案。在这两种情况下,经典策略——最早截止日期和最短处理时间——仍然是最佳策略,只需进行相当简单的修改。当一项任务的开始时间到来时,将该任务与当前正在进行的任务进行比较。如果您按照最早截止日期工作,而新任务的截止日期甚至比当前任务更早,则切换档位;否则,保持原样。同样,如果您按照最短处理时间工作,并且新任务可以比当前任务更快完成,请暂停并先处理新任务;否则,继续您之前的工作。
Minimizing maximum lateness (for serving customers in a coffee shop) or the sum of completion times (for rapidly shortening your to-do list) both cross the line into intractability if some tasks can’t be started until a particular time. But they return to having efficient solutions once preemption is allowed. In both cases, the classic strategies—Earliest Due Date and Shortest Processing Time, respectively—remain the best, with a fairly straightforward modification. When a task’s starting time comes, compare that task to the one currently under way. If you’re working by Earliest Due Date and the new task is due even sooner than the current one, switch gears; otherwise stay the course. Likewise, if you’re working by Shortest Processing Time, and the new task can be finished faster than the current one, pause to take care of it first; otherwise, continue with what you were doing.
现在,在顺利的一周里,机械车间可能在接下来的几天里就能知道所有需要他们做的事情,但我们大多数人通常至少在一定程度上是盲目的。例如,我们甚至不确定什么时候能开始某个项目(某某什么时候能给我一个关于某某的明确答复?)。而且,我们的电话随时都可能响起,或者一封电子邮件随时可能弹出,告诉我们有一项全新的任务需要添加到我们的日程表中。
Now, on a good week a machine shop might know everything expected of them in the next few days, but most of us are usually flying blind, at least in part. We might not even be sure, for instance, when we’ll be able to start a particular project (when will so-and-so give me a solid answer on the such-and-such?). And at any moment our phone can ring or an email can pop up with news of a whole new task to add to our agenda.
事实证明,即使你不知道任务何时开始,“最早截止日期”和“最短处理时间”仍然是最佳策略,能够保证你在面对不确定性时(平均而言)获得最佳表现。如果任务在不可预测的时刻被塞到你的办公桌上,那么最小化最大迟到率的最佳策略仍然是“最早截止日期”的优先版本——如果刚出现的任务比你当前正在做的任务截止时间更早,就切换到它,否则就忽略它。同样,“最短处理时间”的优先版本——比较完成当前任务的剩余时间和完成新任务所需的时间——仍然是最小化完成时间总和的最佳策略。
It turns out, though, that even if you don’t know when tasks will begin, Earliest Due Date and Shortest Processing Time are still optimal strategies, able to guarantee you (on average) the best possible performance in the face of uncertainty. If assignments get tossed on your desk at unpredictable moments, the optimal strategy for minimizing maximum lateness is still the preemptive version of Earliest Due Date—switching to the job that just came up if it’s due sooner than the one you’re currently doing, and otherwise ignoring it. Similarly, the preemptive version of Shortest Processing Time—compare the time left to finish the current task to the time it would take to complete the new one—is still optimal for minimizing the sum of completion times.
事实上,在面对不确定性时,加权版最短处理时间算法是最佳通用调度策略的一个很好的候选方案。它提供了一个简单的时间管理方案:每当有一项新任务到来时,用其重要性除以完成它所需的时间。如果这个数字高于你当前正在执行的任务,就切换到新任务;否则,继续执行当前任务。这个算法是调度理论中最接近万能钥匙或瑞士军刀的东西,它不仅适用于一种问题,也适用于多种问题。在某些假设下,它不仅可以最小化加权完成时间的总和(正如我们预期的那样),还可以最小化延迟作业的权重总和以及这些作业的加权延迟总和。
In fact, the weighted version of Shortest Processing Time is a pretty good candidate for best general-purpose scheduling strategy in the face of uncertainty. It offers a simple prescription for time management: each time a new piece of work comes in, divide its importance by the amount of time it will take to complete. If that figure is higher than for the task you’re currently doing, switch to the new one; otherwise stick with the current task. This algorithm is the closest thing that scheduling theory has to a skeleton key or Swiss Army knife, the optimal strategy not just for one flavor of problem but for many. Under certain assumptions it minimizes not just the sum of weighted completion times, as we might expect, but also the sum of the weights of the late jobs and the sum of the weighted lateness of those jobs.
有趣的是,如果我们提前知道工作的开始时间和持续时间,那么优化所有这些其他指标都是非常困难的。因此,考虑不确定性对调度的影响揭示了一些违反直觉的事情:在某些情况下,千里眼是一种负担。即使拥有完全的预知能力,找到完美的时间表几乎是不可能的。相比之下,在工作到来时随机应变并做出反应并不能给你一个像预知未来那样完美的时间表——但你能做的最好的事情是更容易计算。这多少让人感到安慰。正如商业作家兼程序员杰森·弗里德所说:“感觉在制定一个万无一失的计划之前你无法继续前进?用‘猜测’代替‘计划’,然后放轻松。”调度理论证实了这一点。
Intriguingly, optimizing all these other metrics is intractable if we know the start times and durations of jobs ahead of time. So considering the impact of uncertainty in scheduling reveals something counterintuitive: there are cases where clairvoyance is a burden. Even with complete foreknowledge, finding the perfect schedule might be practically impossible. In contrast, thinking on your feet and reacting as jobs come in won’t give you as perfect a schedule as if you’d seen into the future—but the best you can do is much easier to compute. That’s some consolation. As business writer and coder Jason Fried says, “Feel like you can’t proceed until you have a bulletproof plan in place? Replace ‘plan’ with ‘guess’ and take it easy.” Scheduling theory bears this out.
当未来变得模糊时,你会发现你不需要日历,只需要一份待办事项清单。
When the future is foggy, it turns out you don’t need a calendar—just a to-do list.
抢占并非免费:上下文切换
Preemption Isn’t Free: The Context Switch
我走得越快/我得到的就越落后
The hurrieder I go / The behinder I get
—加州布恩维尔的针尖
—NEEDLEPOINT SEEN IN BOONVILLE, CA
程序员不说话,因为他们不能被打断……与其他人(或他们在电话、蜂鸣器和门铃中的代表)同步只能意味着打断思路。打断意味着某些错误。你不能下车。
Programmers don’t talk because they must not be interrupted.… To synchronize with other people (or their representation in telephones, buzzers and doorbells) can only mean interrupting the thought train. Interruptions mean certain bugs. You must not get off the train.
—艾伦·厄尔曼
—ELLEN ULLMAN
调度理论最终展现出了一个相当鼓舞人心的景象。许多调度问题都有简单、最优的算法来解决,而且这些问题与我们日常生活中遇到的情况非常相似。但当真正在现实世界中执行单机调度时,事情就变得复杂了。
Scheduling theory thus tells a reasonably encouraging story after all. There are simple, optimal algorithms for solving many scheduling problems, and those problems are tantalizingly close to situations we encounter daily in human lives. But when it comes to actually carrying out single-machine scheduling in the real world, things get complicated.
首先,人类和计算机操作系统都面临着一个奇特的挑战:执行调度的机器和被调度的机器是同一台机器。这使得整理待办事项清单成为待办事项清单上的一项——它本身就需要确定优先级并进行调度。
First of all, people and computer operating systems alike face a curious challenge: the machine that is doing the scheduling and the machine being scheduled are one and the same. Which makes straightening out your to-do list an item on your to-do list—needing, itself, to get prioritized and scheduled.
其次,抢占并非免费。每次切换任务都需要付出代价,在计算机科学中称为上下文切换。当计算机处理器将注意力从给定程序移开时,总会有一定的必要开销。它需要有效地标记其位置,并将所有与该程序相关的信息放在一边。然后,它需要确定接下来要运行哪个程序。最后,它必须提取该程序的所有相关信息,找到其在代码中的位置,然后开始运行。
Second, preemption isn’t free. Every time you switch tasks, you pay a price, known in computer science as a context switch. When a computer processor shifts its attention away from a given program, there’s always a certain amount of necessary overhead. It needs to effectively bookmark its place and put aside all of its information related to that program. Then it needs to figure out which program to run next. Finally it must haul out all the relevant information for that program, find its place in the code, and get in gear.
这种来回切换都不是“真正的工作”——也就是说,它们实际上不会提升计算机正在切换的各个程序的状态。这只是元工作(metawork)。每次上下文切换都是在浪费时间。
None of this switching back and forth is “real work”—that is, none of it actually advances the state of any of the various programs the computer is switching between. It’s metawork. Every context switch is wasted time.
人类显然也有上下文切换的成本。当我们在办公桌上移动文件、关闭和打开电脑上的文档、走进房间却记不清是什么让我们来到这里的,或者只是大声说“我刚才说到哪儿了?”或“我刚才说什么了?”时,我们都会感受到这种成本。心理学家已经证明,对我们来说,切换任务的影响可能包括延迟和错误——其影响以分钟而非微秒为单位。从更直观的角度来看,任何被你每小时打断超过几次的人都有可能完全不做任何工作。
Humans clearly have context-switching costs too. We feel them when we move papers on and off our desk, close and open documents on our computer, walk into a room without remembering what had sent us there, or simply say out loud, “Now, where was I?” or “What was I saying?” Psychologists have shown that for us, the effects of switching tasks can include both delays and errors—at the scale of minutes rather than microseconds. To put that figure in perspective, anyone you interrupt more than a few times an hour is in danger of doing no work at all.
就我们个人而言,我们发现编程和写作都需要时刻关注整个系统的状态,因此上下文切换的成本极高。我们一位写软件的朋友说,正常的工作周并不适合他的工作流程,因为对他来说,每天工作16个小时,效率是每天工作8个小时的两倍多。而布莱恩则认为写作就像锻造,需要一段时间才能将金属加热到可锻状态。他觉得留出少于90分钟的时间来写作几乎毫无意义,因为前半个小时除了在脑子里装下一大堆“我刚才说到哪儿了?”之外,几乎什么也没发生。匹兹堡大学的日程安排专家柯克·普鲁斯也有同样的经历。“如果写作时间少于1小时,我就干脆去做些差事,因为我需要花35分钟才能真正弄清楚自己想做什么,然后可能就没时间了。”
Personally, we have found that both programming and writing require keeping in mind the state of the entire system, and thus carry inordinately large context-switching costs. A friend of ours who writes software says that the normal workweek isn’t well suited to his workflow, since for him sixteen-hour days are more than twice as productive as eight-hour days. Brian, for his part, thinks of writing as a kind of blacksmithing, where it takes a while just to heat up the metal before it’s malleable. He finds it somewhat useless to block out anything less than ninety minutes for writing, as nothing much happens in the first half hour except loading a giant block of “Now, where was I?” into his head. Scheduling expert Kirk Pruhs, of the University of Pittsburgh, has had the same experience. “If it’s less than an hour I’ll just do errands instead, because it’ll take me the first thirty-five minutes to really figure out what I want to do and then I might not have time to do it.”
拉迪亚德·吉卜林于 1910 年创作的著名诗歌《如果——》以对时间管理的热情呼吁结尾:“如果你能用六十秒的长跑填满这无情的一分钟……”
Rudyard Kipling’s celebrated 1910 poem “If—” ends with an exuberant call for time management: “If you can fill the unforgiving minute / With sixty seconds’ worth of distance run…”
但愿如此。事实是,总是有开销——浪费在元工作、簿记和任务管理的后勤工作上的时间。这是日程安排的基本权衡之一。你承担的任务越多,开销就越大。在噩梦般的极端情况下,这会变成一种叫做“颠簸”的现象。
If only. The truth is, there’s always overhead—time lost to metawork, to the logistics of bookkeeping and task management. This is one of the fundamental tradeoffs of scheduling. And the more you take on, the more overhead there is. At its nightmarish extreme, this turns into a phenomenon called thrashing.
鞭笞
Thrashing
盖奇:扎克伯格先生,您能集中注意力听我讲话吗?……
Gage: Mr. Zuckerberg, do I have your full attention?…
扎克伯格:你已经吸引了我一部分注意力——但只吸引了最低限度的注意力。
Zuckerberg: You have part of my attention—you have the minimum amount.
—社交网络
—THE SOCIAL NETWORK
计算机通过一个称为“线程”的过程实现多任务处理,你可以把它想象成玩杂耍。就像杂耍演员一次只抛出一个球,但同时保持三个球在空中一样,CPU 一次只运行一个程序,但通过在它们之间快速切换(以万分之一秒为单位),它看起来就像在同时播放电影、浏览网页以及提醒你收到电子邮件。
Computers multitask through a process called “threading,” which you can think of as being like juggling a set of balls. Just as a juggler only hurls one ball at a time into the air but keeps three aloft, a CPU only works on one program at a time, but by swapping between them quickly enough (on the scale of ten-thousandths of a second) it appears to be playing a movie, navigating the web, and alerting you to incoming email all at once.
20世纪60年代,计算机科学家开始思考如何自动化不同任务和用户之间共享计算机资源的过程。彼得·丹宁(Peter Denning)回忆说,那是一个激动人心的时代。丹宁现在是计算机多任务领域的顶尖专家之一,当时正在麻省理工学院攻读博士学位。兴奋之余,也充满了不确定性:“当一些作业想要增加内存,而另一些作业想要减少内存,它们会相互交互,试图窃取[内存]等等时,你该如何分配主内存呢?……你该如何管理所有这些交互?当时没有人对此有所了解。”
In the 1960s, computer scientists began thinking about how to automate the process of sharing computer resources between different tasks and users. It was an exciting time, recounts Peter Denning, now one of the top experts on computer multitasking, who was then working on his doctorate at MIT. Exciting, and uncertain: “How do you partition a main memory among a bunch of jobs that are in there when some of them want to grow and some might want to shrink and they’re going to interact with each other, trying to steal [memory] and all these kinds of things?… How do you manage that whole set of interactions? Nobody knew anything about that.”
毫不奇怪,鉴于研究人员当时并不真正了解自己在做什么,他们的努力遇到了困难。其中有一个问题尤其引起了他们的注意。正如丹宁所解释的,在某些情况下,一个戏剧性的问题“会在你向多道程序组合中添加更多作业时出现。在某个时刻,你会越过一个临界阈值——它究竟在哪里无法预测,但当你到达那里时你就会知道——然后系统突然间似乎就崩溃了。”
Not surprisingly, given that the researchers didn’t really know yet what they were doing, the effort encountered difficulties. And there was one in particular that caught their attention. As Denning explains, under certain conditions a dramatic problem “shows up as you add more jobs to the multiprogramming mix. At some point you pass a critical threshold—unpredictable exactly where it is, but you’ll know it when you get there—and all of a sudden the system seems to die.”
再想象一下玩杂耍的人的形象。当一个球在空中时,有足够的空闲时间让玩杂耍的人把其他球也向上抛。但是,如果玩杂耍的人多接了一个球,超过了他能处理的数量,会怎么样呢?他不是掉了那个球,而是掉了所有球。毫不夸张地说,整个系统都瘫痪了。正如丹宁所说,“一个额外程序的出现导致了服务的彻底崩溃……这两种情况之间的巨大差异一开始是违背直觉的,这可能导致我们预期随着新程序被引入拥挤的主内存,服务会逐渐下降。”然而,灾难来了。虽然我们可以理解人类玩杂耍的人不堪重负,但是什么原因导致机器发生这样的事情呢?
Think again about our image of a juggler. With one ball in the air, there’s enough spare time while that ball is aloft for the juggler to toss some others upward as well. But what if the juggler takes on one more ball than he can handle? He doesn’t drop that ball; he drops everything. The whole system, quite literally, goes down. As Denning puts it, “The presence of one additional program has caused a complete collapse of service.… The sharp difference between the two cases at first defies intuition, which might lead us to expect a gradual degradation of service as new programs are introduced into crowded main memory.” Instead, catastrophe. And while we can understand a human juggler being overwhelmed, what could cause something like this to happen to a machine?
这里,调度理论与缓存理论相交。缓存的整个理念是保持所需项目的“工作集”可供快速访问。实现这一点的方法之一是将计算机当前使用的信息保存在快速内存中,而不是慢速硬盘上。但是,如果一项任务需要跟踪的内容太多,以至于无法全部装入内存,那么最终你可能会花费比实际工作更多的时间在信息交换上。此外,当你切换任务时,新激活的任务可能会通过从内存中逐出其他工作集的部分内容来为其工作集腾出空间。下一个任务在重新激活后,会从硬盘中重新获取其工作集的部分内容,并将其强行放回内存,再次取代其他任务。这种任务之间互相抢占空间的问题在处理器和内存之间缓存层级结构的系统中会变得更加严重。正如 Linux 操作系统调度程序的首席开发人员之一 Peter Zijlstra 所说:“缓存对于当前工作负载来说已经很热了,当你进行上下文切换时,几乎所有缓存都会失效。这很麻烦。” 在极端情况下,一个程序可能运行的时间刚好够它所需的数据交换到内存中,然后就让另一个运行时间刚好够覆盖这些数据的程序来执行。
Here scheduling theory intersects caching theory. The whole idea of caches is to keep the “working set” of needed items available for quick access. One way this is done is by keeping the information the computer is currently using in fast memory rather than on the slow hard disk. But if a task requires keeping track of so many things that they won’t all fit into memory, then you might well end up spending more time swapping information in and out of memory than doing the actual work. What’s more, when you switch tasks, the newly active task might make space for its working set by evicting portions of other working sets from memory. The next task, upon reactivation, would then reacquire parts of its working set from the hard disk and muscle them back into memory, again displacing others. This problem—tasks stealing space from each other—can get even worse in systems with hierarchies of caches between the processor and the memory. As Peter Zijlstra, one of the head developers on the Linux operating system scheduler, puts it, “The caches are warm for the current workload, and when you context switch you pretty much invalidate all caches. And that hurts.” At the extreme, a program may run just long enough to swap its needed items into memory, before giving way to another program that runs just long enough to overwrite them in turn.
这就是“系统抖动”:系统全速运转却毫无进展。丹宁最初是在内存管理的背景下诊断出这种现象的,但现在计算机科学家用“系统抖动”一词来指代几乎所有系统因完全专注于元工作而陷入停滞的情况。一台处于抖动状态的计算机的性能并非逐渐下降,而是急剧下降。“实际工作”实际上已经降为零,这也意味着它几乎不可能摆脱困境。
This is thrashing: a system running full-tilt and accomplishing nothing at all. Denning first diagnosed this phenomenon in a memory-management context, but computer scientists now use the term “thrashing” to refer to pretty much any situation where the system grinds to a halt because it’s entirely preoccupied with metawork. A thrashing computer’s performance doesn’t bog down gradually. It falls off a cliff. “Real work” has dropped to effectively zero, which also means it’s going to be nearly impossible to get out.
疲惫不堪是人类非常常见的状态。如果你曾经有过这样的时刻:你想放下手头上的一切,只为能把所有应该做的事情都写下来,却又抽不出时间,那么你就经历过疲惫不堪。而造成这种情况的原因对人类和计算机来说大致相同:每项任务都会消耗我们有限的认知资源。当仅仅是记住所有需要做的事情就占据了我们的全部注意力——或者为每项任务排定优先级会耗费我们所有的时间——或者我们的思路在转化为行动之前不断被打断——那种感觉就像恐慌,就像过度活跃导致的瘫痪。这就是疲惫不堪,计算机对此非常了解。
Thrashing is a very recognizable human state. If you’ve ever had a moment where you wanted to stop doing everything just to have the chance to write down everything you were supposed to be doing, but couldn’t spare the time, you’ve thrashed. And the cause is much the same for people as for computers: each task is a draw on our limited cognitive resources. When merely remembering everything we need to be doing occupies our full attention—or prioritizing every task consumes all the time we had to do them—or our train of thought is continually interrupted before those thoughts can translate to action—it feels like panic, like paralysis by way of hyperactivity. It’s thrashing, and computers know it well.
如果您曾经与处于系统抖动状态的系统搏斗过——或者您曾经经历过这样的状态——那么您可能会对如何摆脱这种状态的计算机科学感到好奇。丹宁在他于20世纪60年代发表的关于此主题的里程碑式论文中指出,一分预防胜过十分治疗。最简单的方法就是增加内存:例如,足够的RAM,以便将所有正在运行的程序的工作集一次性加载到内存中,并减少上下文切换的时间。但是,当您发现自己正处于系统抖动状态时,这些预防抖动的建议对您毫无帮助。此外,当涉及到人类的注意力时,我们只能依靠现有的资源。
If you’ve ever wrestled with a system in a state of thrashing—and if you’ve ever been in such a state—then you might be curious about the computer science of getting out. In his landmark 1960s paper on the subject, Denning noted that an ounce of prevention is worth a pound of cure. The easiest thing to do is simply to get more memory: enough RAM, for instance, to fit the working sets of all the running programs into memory at once and reduce the time taken by a context switch. But preventive advice for thrashing doesn’t help you when you find yourself in the midst of it. Besides, when it comes to human attention, we’re stuck with what we’ve got.
另一种在系统抖动开始前就避免它的方法是学会说“不”。例如,丹宁就主张,如果系统没有足够的可用内存来容纳其工作集,就应该直接拒绝将程序添加到其工作负载中。这可以防止机器抖动,对于任何忙得不可开交的人来说都是一个明智的建议。但对于那些已经超负荷运转,或者无法控制自身负载的人来说,这似乎也是一种难以企及的奢侈。
Another way to avert thrashing before it starts is to learn the art of saying no. Denning advocated, for instance, that a system should simply refuse to add a program to its workload if it didn’t have enough free memory to hold its working set. This prevents thrashing in machines, and is sensible advice for anyone with a full plate. But this, too, might seem like an unattainable luxury to those of us who find ourselves already overloaded—or otherwise unable to throttle the demands being placed on us.
在这些情况下,显然没有办法再努力工作了,但你可以更笨地工作。除了考虑记忆之外,在切换上下文时,最大的元工作来源之一就是选择下一步做什么的行为。这有时也会淹没实际的工作。面对一个塞满n 条消息的收件箱,我们从排序理论中知道,反复扫描它以找到接下来要回答的最重要的一条消息需要O ( n2 ) 次操作——每条消息扫描n次。这意味着醒来发现收件箱比平时满了三倍,你需要花费九倍的时间来处理。更重要的是,浏览这些电子邮件意味着在你回复任何一条消息之前,你需要将每一条消息一个接一个地交换到你的脑海中:这肯定会导致记忆力崩溃。
In these cases there’s clearly no way to work any harder, but you can work … dumber. Along with considerations of memory, one of the biggest sources of metawork in switching contexts is the very act of choosing what to do next. This, too, can at times swamp the actual doing of the work. Faced with, say, an overflowing inbox of n messages, we know from sorting theory that repeatedly scanning it for the most important one to answer next will take O(n2) operations—n scans of n messages apiece. This means that waking up to an inbox that’s three times as full as usual could take you nine times as long to process. What’s more, scanning through those emails means swapping every message into your mind, one after another, before you respond to any of them: a surefire recipe for memory thrashing.
在颠簸的状态下,你基本上没有任何进展,所以即使以错误的顺序执行任务也比什么都不做要好。与其先回复最重要的邮件(这需要全面评估,可能比工作本身耗时更长),不如直接以随机顺序回复邮件,或者按照它们在屏幕上出现的顺序来回复,这样可以避免陷入二次时间的困境。出于同样的考虑,几年前,Linux 核心团队将他们的调度程序替换成了一个在计算进程优先级方面不那么“智能”的程序,但它通过减少计算时间弥补了这一缺陷。
In a thrashing state, you’re making essentially no progress, so even doing tasks in the wrong order is better than doing nothing at all. Instead of answering the most important emails first—which requires an assessment of the whole picture that may take longer than the work itself—maybe you should sidestep that quadratic-time quicksand by just answering the emails in random order, or in whatever order they happen to appear on-screen. Thinking along the same lines, the Linux core team, several years ago, replaced their scheduler with one that was less “smart” about calculating process priorities but more than made up for it by taking less time to calculate them.
不过,如果您仍然想保持自己的优先事项,那么您可以达成一项不同的、甚至更有趣的交易来恢复您的工作效率。
If you still want to maintain your priorities, though, there’s a different and even more interesting bargain you can strike to get your productivity back.
中断合并
Interrupt Coalescing
实时调度之所以如此复杂和有趣,部分原因在于它本质上是两个并不完全兼容的原则之间的协调。这两个原则被称为响应度和吞吐量:你对事物的响应速度,以及你总体上能完成多少工作。任何在办公室环境中工作过的人都能很容易地体会到这两个指标之间的矛盾。这也是为什么有些人的工作就是接电话:他们响应迅速,以便其他人能够有吞吐量。
Part of what makes real-time scheduling so complex and interesting is that it is fundamentally a negotiation between two principles that aren’t fully compatible. These two principles are called responsiveness and throughput: how quickly you can respond to things, and how much you can get done overall. Anyone who’s ever worked in an office environment can readily appreciate the tension between these two metrics. It’s part of the reason there are people whose job it is to answer the phone: they are responsive so that others may have throughput.
再说一次,生活会更艰难——就像一台电脑——你必须自己权衡响应速度和吞吐量。而完成任务的最佳策略,或许恰恰相反,是放慢速度。
Again, life is harder when—like a computer—you must make the responsiveness/throughput tradeoff yourself. And the best strategy for getting things done might be, paradoxically, to slow down.
操作系统调度程序通常会定义一个“周期”,保证每个程序至少运行一小段时间,系统会将该周期的一部分分配给每个程序。运行的程序越多,这些“时间片”就越小,每个周期发生的上下文切换就越多,最终以吞吐量为代价来维持响应速度。然而,如果不加以控制,这种保证每个进程在每个周期至少获得一定关注的策略可能会导致灾难。当运行的程序足够多时,一个任务的时间片会缩小到系统将整个时间片都花在上下文切换上,然后立即切换到下一个任务。
Operating system schedulers typically define a “period” in which every program is guaranteed to run at least a little bit, with the system giving a “slice” of that period to each program. The more programs are running, the smaller those slices become, and the more context switches are happening every period, maintaining responsiveness at the cost of throughput. Left unchecked, however, this policy of guaranteeing each process at least some attention every period could lead to catastrophe. With enough programs running, a task’s slice would shrink to the point that the system was spending the entire slice on context switching, before immediately context-switching again to the next task.
罪魁祸首是硬响应保证。因此,现代操作系统实际上为其切片设置了最小长度,并且拒绝将周期细分得更细。(例如,在 Linux 中,这个最小可用切片大约是四分之三毫秒,但对于人类来说,实际上可能至少是几分钟。)如果在此之后添加更多进程,周期只会变得更长。这意味着进程必须等待更长时间才能轮到它们,但它们获得的轮次至少足够长来执行某些操作。
The culprit is the hard responsiveness guarantee. So modern operating systems in fact set a minimum length for their slices and will refuse to subdivide the period any more finely. (In Linux, for instance, this minimum useful slice turns out to be about three-quarters of a millisecond, but in humans it might realistically be at least several minutes.) If more processes are added beyond that point, the period will simply get longer. This means that processes will have to wait longer to get their turn, but the turns they get will at least be long enough to do something.
设定每个任务的最短时间有助于防止对响应能力的承诺完全损害吞吐量:如果最短时间片比上下文切换所需的时间长,那么系统就永远不会进入只进行上下文切换的状态。这条原则也很容易转化为对人类生活的建议。诸如“时间盒”或“番茄钟”之类的方法,也就是设置一个厨房计时器,并承诺完成一项任务直到计时器用完,就是这一理念的体现。
Establishing a minimum amount of time to spend on any one task helps to prevent a commitment to responsiveness from obliterating throughput entirely: if the minimum slice is longer than the time it takes to context-switch, then the system can never get into a state where context switching is the only thing it’s doing. It’s also a principle that is easy to translate into a recommendation for human lives. Methods such as “timeboxing” or “pomodoros,” where you literally set a kitchen timer and commit to doing a single task until it runs out, are one embodiment of this idea.
但是,切片大小应该是多少呢?对于执行重复任务(例如查看电子邮件)的间隔时间问题,从吞吐量的角度来看,答案很简单:尽可能长。但这并不是故事的结局;毕竟,更高的吞吐量也意味着更低的响应速度。
But what slice size should you aim for? Faced with the question of how long to wait between intervals of performing a recurring task, like checking your email, the answer from the perspective of throughput is simple: as long as possible. But that’s not the end of the story; higher throughput, after all, also means lower responsiveness.
对于你的计算机来说,它必须定期检查的恼人干扰并非电子邮件,而是你自己。你可能几分钟或几小时都不会移动鼠标,但当你移动鼠标时,你希望看到屏幕上的指针立即移动,这意味着机器仅仅为了检查你的状态就需要付出巨大的努力。它检查鼠标和键盘的频率越高,在有输入时就能反应越快,但也需要进行上下文切换的次数就越多。因此,计算机操作系统在决定自己能够承受多长的时间用于某项任务时遵循的规则很简单:尽可能长时间地运行,而不会让用户感到紧张或缓慢。
For your computer, the annoying interruption that it has to check on regularly isn’t email—it’s you. You might not move the mouse for minutes or hours, but when you do, you expect to see the pointer on the screen move immediately, which means the machine expends a lot of effort simply checking in on you. The more frequently it checks on the mouse and keyboard, the quicker it can react when there is input, but the more context switches it has to do. So the rule that computer operating systems follow when deciding how long they can afford to dedicate themselves to some task is simple: as long as possible without seeming jittery or slow to the user.
当我们人类出门办点事时,我们可能会说:“你甚至不会注意到我走了。” 当我们的机器切换到计算模式时,它们必须在我们注意到它们离开之前回到我们身边。为了找到这个平衡点,操作系统程序员求助于心理学,从心理物理学的论文中挖掘出人脑感知延迟或闪烁所需的确切毫秒数。 更频繁地关注用户是没有意义的。
When we humans leave the house to run a quick errand, we might say something like, “You won’t even notice I’m gone.” When our machines context-switch into a computation, they must literally return to us before we notice they’re gone. To find this balancing point, operating systems programmers have turned to psychology, mining papers in psychophysics for the exact number of milliseconds of delay it takes for a human brain to register lag or flicker. There is no point in attending to the user any more often than that.
正是由于这些努力,当操作系统正常运行时,你甚至不会注意到计算机的负载有多大。即使处理器全速运转,你仍然能够流畅地在屏幕上移动鼠标。这种流畅性会降低一些吞吐量,但这是系统工程师明确做出的设计权衡:你的系统会尽可能多地远离与你的交互,然后及时重新绘制鼠标。
Thanks to these efforts, when operating systems are working right you don’t even notice how hard your computer is exerting itself. You continue to be able to move your mouse around the screen fluidly even when your processor is hauling full-tilt. The fluidity is costing you some throughput, but that’s a design tradeoff that has been explicitly made by the system engineers: your system spends as much time as it possibly can away from interacting with you, then gets around to redrawing the mouse just in time.
再说一次,这条原则可以应用于人类生活。它的寓意是,你应该尽可能长时间地专注于一项任务,但不要将你的响应速度降低到可接受的最低限度以下。确定你需要多快的响应速度——然后,如果你想完成任务,就不要超过这个速度。
And again, this is a principle that can be transferred to human lives. The moral is that you should try to stay on a single task as long as possible without decreasing your responsiveness below the minimum acceptable limit. Decide how responsive you need to be—and then, if you want to get things done, be no more responsive than that.
如果你发现自己因为处理一系列异构的短任务而频繁进行上下文切换,你也可以借鉴计算机科学的另一个理念:“中断合并”。例如,如果你有五张信用卡账单,不要等到它们到达时才支付;而是在第五张账单到来时一次性全部处理完毕。只要你的账单到期日不超过31天,你就可以指定每月的第一天为“付款日”,并在当天处理桌上的每一张账单,无论它是三周前还是三小时前收到的。同样,如果你的邮件收件人都不要求你在24小时内回复,你可以限制自己每天查看一次邮件。计算机本身也会这样做:它们会等待某个固定的时间间隔并检查所有内容,而不是通过上下文切换来处理来自各个子组件的独立、互不协调的中断。*
If you find yourself doing a lot of context switching because you’re tackling a heterogeneous collection of short tasks, you can also employ another idea from computer science: “interrupt coalescing.” If you have five credit card bills, for instance, don’t pay them as they arrive; take care of them all in one go when the fifth bill comes. As long as your bills are never due less than thirty-one days after they arrive, you can designate, say, the first of each month as “bill-paying day,” and sit down at that point to process every bill on your desk, no matter whether it came three weeks or three hours ago. Likewise, if none of your email correspondents require you to respond in less than twenty-four hours, you can limit yourself to checking your messages once a day. Computers themselves do something like this: they wait until some fixed interval and check everything, instead of context-switching to handle separate, uncoordinated interrupts from their various subcomponents.*
计算机科学家偶尔会注意到,他们生活中也缺乏中断合并。谷歌研究总监彼得·诺维格(Peter Norvig)说:“我今天不得不去市中心办三次事,然后我就说,‘哦,好吧,那只是你算法里一行代码的bug。你应该等着,或者把它添加到待办事项队列里,而不是像以前那样一个接一个地按顺序执行。’”
On occasion, computer scientists notice the absence of interrupt coalescing in their own lives. Says Google director of research Peter Norvig: “I had to go downtown three times today to run errands, and I said, ‘Oh, well, that’s just a one-line bug in your algorithm. You should have just waited, or added it to the to-do queue, rather than executing them sequentially as they got added one at a time.’”
从人类的角度来看,邮政系统可以免费整合各种干扰,这完全是其投递周期的必然结果。由于邮件每天只投递一次,所以即使只是晚寄几分钟,也可能需要额外二十四小时才能送达。考虑到上下文切换的成本,其中的一点好处现在应该显而易见了:你每天最多只会被账单和信件打扰一次。而且,二十四小时的邮政节奏对你的响应速度要求极低:收到信件后五分钟还是五小时寄出回信,都没有任何区别。
At human scale, we get interrupt coalescing for free from the postal system, just as a consequence of their delivery cycle. Because mail gets delivered only once a day, something mailed only a few minutes late might take an extra twenty-four hours to reach you. Considering the costs of context switching, the silver lining to this should by now be obvious: you can only get interrupted by bills and letters at most once a day. What’s more, the twenty-four-hour postal rhythm demands minimal responsiveness from you: it doesn’t make any difference whether you mail your reply five minutes or five hours after receiving a letter.
在学术界,安排办公时间是避免学生打扰的一种方式。而在私营部门,这种避免打扰的方式,为最受诟病的办公室惯例之一——每周例会——提供了一种救赎。无论定期安排的会议有何弊端,它都是我们抵御自发干扰和计划外的上下文切换的最佳方法之一。
In academia, holding office hours is a way of coalescing interruptions from students. And in the private sector, interrupt coalescing offers a redemptive view of one of the most maligned office rituals: the weekly meeting. Whatever their drawbacks, regularly scheduled meetings are one of our best defenses against the spontaneous interruption and the unplanned context switch.
传奇程序员唐纳德·克努斯 (Donald Knuth) 或许是这种最小化上下文切换生活方式的守护神。他表示:“我一次只做一件事。这就是计算机科学家所说的批处理——另一种选择是换入和换出。我不换入和换出。”克努斯并不是在开玩笑。2014 年 1 月 1 日,他开始了“2014 年的 TeX 调优”,修复了过去六年中他的 TeX 排版软件中报告的所有错误。他的报告以一句令人愉快的结束语结束:“敬请期待 2021 年的 TeX 调优!”同样,克努斯自 1990 年以来就没有电子邮件地址了。“对于那些在生活中的角色是掌控一切的人来说,电子邮件是一件很棒的事情。但对我来说不是;我的角色是在事物的底层。我的工作需要长时间的学习和不间断的专注。”他每三个月检查一次所有邮件,每六个月检查一次所有传真。
Perhaps the patron saint of the minimal-context-switching lifestyle is the legendary programmer Donald Knuth. “I do one thing at a time,” he says. “This is what computer scientists call batch processing—the alternative is swapping in and out. I don’t swap in and out.” Knuth isn’t kidding. On January 1, 2014, he embarked on “The TeX Tuneup of 2014,” in which he fixed all of the bugs that had been reported in his TeX typesetting software over the previous six years. His report ends with the cheery sign-off “Stay tuned for The TeX Tuneup of 2021!” Likewise, Knuth has not had an email address since 1990. “Email is a wonderful thing for people whose role in life is to be on top of things. But not for me; my role is to be on the bottom of things. What I do takes long hours of studying and uninterruptible concentration.” He reviews all his postal mail every three months, and all his faxes every six.
但即使我们不必像 Knuth 那样极端,也希望我们生活中更多人能将中断合并作为设计原则。邮局几乎是偶然赋予我们这种功能;在其他地方,我们需要自己构建它,或者要求它。我们那些发出嘟嘟声和嗡嗡声的设备都有“请勿打扰”模式,我们可以全天手动切换开关,但这种手段太过生硬。相反,我们或许应该呼吁提供明确的中断合并选项——在人类的时间尺度上,与设备内部所做的一样。比如,每十分钟提醒我一次;然后告诉我所有信息。
But one does not need to take things to Knuth’s extreme to wish that more of our lives used interrupt coalescing as a design principle. The post office gives it to us almost by accident; elsewhere, we need to build it, or demand it, for ourselves. Our beeping and buzzing devices have “Do Not Disturb” modes, which we could manually toggle on and off throughout the day, but that is too blunt an instrument. Instead, we might agitate for settings that would provide an explicit option for interrupt coalescing—the same thing at a human timescale that the devices are doing internally. Alert me only once every ten minutes, say; then tell me everything.
*讽刺的是,Pathfinder 软件团队负责人 Glenn Reeves 竟然把这个问题归咎于“截止日期的压力”,以及在开发过程中修复这个问题被认为是“优先级较低的”。所以,从某种意义上说,问题的根本原因恰恰反映了问题本身。
*Ironically enough, Pathfinder software team leader Glenn Reeves would blame the bug on “deadline pressures,” and on the fact that fixing this particular issue during development had been deemed a “lower priority.” So the root cause, in a sense, mirrored the problem itself.
*我们将在第 8 章更详细地讨论“棘手”的问题。
*We will discuss “intractable” problems in more detail in chapter 8.
*不过,事情并没有这个数字看起来那么糟糕,因为它包括涉及多台机器的调度问题——这更像是管理一组员工,而不是管理日历。
*Things aren’t quite as bad as this number might make them seem, though, since it includes scheduling problems involving multiple machines—which is more like managing a group of employees than managing your calendar.
*很多电脑每次需要我们输入信息时,都会突然弹出错误信息和占用我们光标的对话框,这多少有点虚伪。用户界面对用户的注意力的吸引,是CPU本身难以忍受的。
*Given that many computers tend to brashly pop up error messages and cursor-stealing dialogue boxes whenever they want something from us, their behavior is somewhat hypocritical. The user interface demands the user’s attention in a way that the CPU itself would rarely tolerate.
人类的一切知识都是不确定的、不精确的和不完整的。
All human knowledge is uncertain, inexact, and partial.
—伯特兰·罗素
—BERTRAND RUSSELL
明天太阳会出来。我敢打赌,明天一定会有阳光。
The sun’ll come out tomorrow. You can bet your bottom dollar there’ll be sun.
—安妮
—ANNIE
1969年,在普林斯顿大学攻读天体物理学博士学位之前,J·理查德·戈特三世(J. Richard Gott III)去了一趟欧洲。在那里,他看到了八年前修建的柏林墙。站在柏林墙的阴影下,这堵墙是冷战的鲜明象征,他开始思考,这堵墙还要分裂东西方多久。
In 1969, before embarking on a doctorate in astrophysics at Princeton, J. Richard Gott III took a trip to Europe. There he saw the Berlin Wall, which had been built eight years earlier. Standing in the shadow of the wall, a stark symbol of the Cold War, he began to wonder how much longer it would continue to divide the East and West.
从表面上看,试图做出这种预测本身就有些荒谬。即使撇开预测地缘政治的不可能性不谈,这个问题在数学上也显得可笑:它试图从单一数据点进行预测。
On the face of it, there’s something absurd about trying to make this kind of prediction. Even setting aside the impossibility of forecasting geopolitics, the question seems mathematically laughable: it’s trying to make a prediction from a single data point.
尽管这听起来可能很荒谬,但我们总是会做出这样的预测,这是必然的。你到达一个外国城市的公交车站,或许发现站在那里的另一位游客已经等了七分钟。下一班公交车大概什么时候到?值得等吗?如果值得,你应该等多久才放弃?
But as ridiculous as this might seem on its face, we make such predictions all the time, by necessity. You arrive at a bus stop in a foreign city and learn, perhaps, that the other tourist standing there has been waiting seven minutes. When is the next bus likely to arrive? Is it worthwhile to wait—and if so, how long should you do so before giving up?
或者你的朋友刚和某人约会一个月,想听听你的建议:现在邀请他们参加即将举行的家庭婚礼是不是太早了?你们的关系开始得不错——但提前多久做计划才安全呢?
Or perhaps a friend of yours has been dating somebody for a month and wants your advice: is it too soon to invite them along to an upcoming family wedding? The relationship is off to a good start—but how far ahead is it safe to make plans?
谷歌研究总监彼得·诺维格(Peter Norvig)曾做过一个著名的演讲,题为“数据的不合理有效性”,并热情洋溢地阐述了“数十亿个琐碎的数据点如何能够带来理解”。媒体不断告诉我们,我们正生活在“大数据时代”,计算机可以筛选数十亿个数据点,发现肉眼无法察觉的模式。但与人类日常生活息息相关的问题往往恰恰相反。我们的生活充满了“小数据”。事实上,就像站在柏林墙边的戈特一样,我们常常需要从我们所能掌握的最小量数据——一个单一的观察结果——中进行推断。
A famous presentation made by Peter Norvig, Google’s director of research, carried the title “The Unreasonable Effectiveness of Data” and enthused about “how billions of trivial data points can lead to understanding.” The media constantly tell us that we’re living in an “age of big data,” when computers can sift through those billions of data points and find patterns invisible to the naked eye. But often the problems most germane to daily human life are at the opposite extreme. Our days are full of “small data.” In fact, like Gott standing at the Berlin Wall, we often have to make an inference from the smallest amount of data we could possibly have: a single observation.
那么我们该怎么做呢?我们应该怎么做呢?
So how do we do it? And how should we?
故事开始于十八世纪的英国,当时伟大的数学家,甚至神职人员也对赌博这个领域有着难以抗拒的好奇心。
The story begins in eighteenth-century England, in a domain of inquiry irresistible to great mathematical minds of the time, even those of the clergy: gambling.
贝叶斯逆向推理
Reasoning Backward with the Reverend Bayes
因此,如果我们通过论证来相信过去的经验,并将其作为我们未来判断的标准,那么这些论证就一定只是可能的。
If we be, therefore, engaged by arguments to put trust in past experience, and make it the standard of our future judgement, these arguments must be probable only.
—大卫·休谟
—DAVID HUME
250 多年前,如何根据小数据做出预测的问题一直困扰着英国迷人温泉小镇汤布里奇韦尔斯的长老会牧师托马斯·贝叶斯 (Thomas Bayes)。
More than 250 years ago, the question of making predictions from small data weighed heavily on the mind of the Reverend Thomas Bayes, a Presbyterian minister in the charming spa town of Tunbridge Wells, England.
贝叶斯设想,如果我们购买十张彩票参加一个全新的、不为人熟知的抽奖活动,其中五张中奖,那么估计中奖概率似乎相对容易:5/10,也就是50%。但如果我们只买一张彩票,结果中奖了呢?我们真的会把中奖概率想象成1/1,也就是100%吗?这似乎太乐观了。是这样吗?如果是这样,那么中奖概率是多少?我们实际上应该猜多少?
If we buy ten tickets for a new and unfamiliar raffle, Bayes imagined, and five of them win prizes, then it seems relatively easy to estimate the raffle’s chances of a win: 5/10, or 50%. But what if instead we buy a single ticket and it wins a prize? Do we really imagine the probability of winning to be 1/1, or 100%? That seems too optimistic. Is it? And if so, by how much? What should we actually guess?
对于一位对不确定性推理史产生如此深远影响的人来说,贝叶斯自身的历史却颇具讽刺意味地充满不确定性。他出生于1701年,或许是1702年,出生地是英国赫特福德郡,又或许是伦敦。在1746年、1747年、1748年或1749年,他撰写了数学史上最具影响力的论文之一,却在未发表的情况下弃之不顾,转而致力于其他研究。
For somebody who has had such an impact on the history of reasoning under uncertainty, Bayes’s own history remains ironically uncertain. He was born in 1701, or perhaps 1702, in the English county of Hertfordshire, or maybe it was London. And in either 1746, ’47, ’48, or ’49 he would write one of the most influential papers in all of mathematics, abandon it unpublished, and move on to other things.
这两件事之间,我们稍微确定了一些。贝叶斯的父亲是一位牧师,他进入爱丁堡大学学习神学,并像他的父亲一样被授予神职。他对数学和神学都感兴趣,并于1736年撰写了一篇充满激情的文章,为牛顿新奇的“微积分”辩护,以回应乔治·贝克莱主教的攻击。这项工作使他在1742年当选为皇家学会会员,并被推荐为“一位绅士……精通几何学以及数学和哲学的各个方面”。
Between those two events we have a bit more certainty. The son of a minister, Bayes went to the University of Edinburgh to study theology, and was ordained like his father. He had mathematical as well as theological interests, and in 1736 he wrote an impassioned defense of Newton’s newfangled “calculus” in response to an attack by Bishop George Berkeley. This work resulted in his election in 1742 as a Fellow of the Royal Society, to whom he was recommended as “a Gentleman … well skilled in Geometry and all parts of Mathematical and Philosophical Learning.”
1761年贝叶斯去世后,他的朋友理查德·普莱斯受邀审阅他的数学论文,看看其中是否有可发表的内容。普莱斯偶然发现了一篇令他兴奋的文章——他说这篇文章“很有价值,值得保存”。这篇文章讨论的正是当时正在讨论的抽奖问题:
After Bayes died in 1761, his friend Richard Price was asked to review his mathematical papers to see if they contained any publishable material. Price came upon one essay in particular that excited him—one he said “has great merit, and deserves to be preserved.” The essay concerned exactly the kind of raffle problem under discussion:
那么,让我们设想一下,有人在场观看彩票开奖,但他对彩票的开奖流程和中奖率一无所知。进一步假设,他只能根据听到的开奖结果,通过比较中奖人数和中奖人数来推断彩票的开奖结果;并询问他在这种情况下能得出什么合理的结论。
Let us then imagine a person present at the drawing of a lottery, who knows nothing of its scheme or of the proportion of Blanks to Prizes in it. Let it further be supposed, that he is obliged to infer this from the number of blanks he hears drawn compared with the number of prizes; and that it is enquired what conclusions in these circumstances he may reasonably make.
贝叶斯的关键洞见在于,试图通过我们看到的中奖和未中奖彩票来推断它们来自哪个彩票池,本质上是一种逆向推理。他认为,要做到这一点,我们首先需要从假设出发进行正向推理。换句话说,我们需要首先确定,如果各种情况都成立,我们抽到这些彩票的可能性有多大。这个概率——现代统计学家称之为“似然率”——为我们提供了解决问题所需的信息。
Bayes’s critical insight was that trying to use the winning and losing tickets we see to figure out the overall ticket pool that they came from is essentially reasoning backward. And to do that, he argued, we need to first reason forward from hypotheticals. In other words, we need to first determine how probable it is that we would have drawn the tickets we did if various scenarios were true. This probability—known to modern statisticians as the “likelihood”—gives us the information we need to solve the problem.
例如,假设我们买了三张彩票,三张都中奖了。如果抽奖的奖额特别大,所有彩票都中奖,那么我们“三中三”的情况当然会一直发生;在这种情况下,它的概率是100%。相反,如果只有一半的彩票中奖,那么“三中三”的情况发生的概率将是1 / 2 × 1 / 2 × 1 / 2 ,换句话说,是1/8的概率。如果抽奖的概率只有千分之一,那么我们的结果将极其不可能:1 / 1,000 × 1 / 1,000 × 1 / 1,000,也就是十亿分之一。
For instance, imagine we bought three tickets and all three were winners. Now, if the raffle was of the particularly generous sort where all the tickets are winners, then our three-for-three experience would of course happen all of the time; it has a 100% chance in that scenario. If, instead, only half of the raffle’s tickets were winners, our three-for-three experience would happen 1⁄2 × 1⁄2 × 1⁄2 of the time, or in other words 1⁄8 of the time. And if the raffle rewarded only one ticket in a thousand, our outcome would have been incredibly unlikely: 1⁄1,000 × 1⁄1,000 × 1⁄1,000, or one in a billion.
贝叶斯认为,我们应该相应地判断所有彩票中奖的可能性大于一半彩票中奖的可能性,而一半彩票中奖的可能性又大于千分之一彩票中奖的可能性。我们或许已经凭直觉知道了这一点,但贝叶斯的逻辑使我们能够量化这种直觉。在其他条件相同的情况下,我们应该想象所有彩票中奖的可能性恰好是一半彩票中奖的八倍——因为在这种情况下,我们抽出的彩票的概率恰好是八倍(100% 对 8 分之一)。同样,一半彩票中奖的可能性恰好是千分之一只有一张彩票中奖的可能性的 1.25 亿倍,而千分之一中奖的可能性我们可以通过比较八分之一和十亿分之一来得知。
Bayes argued that we should accordingly judge it to be more probable that all the raffle tickets are winners than that half of them are, and in turn more probable that half of them are than that only one in a thousand is. Perhaps we had already intuited as much, but Bayes’s logic offers us the ability to quantify that intuition. All things being equal, we should imagine it to be exactly eight times likelier that all the tickets are winners than that half of them are—because the tickets we drew are exactly eight times likelier (100% versus one-in-eight) in that scenario. Likewise, it’s exactly 125 million times likelier that half the raffle tickets are winners than that there’s only one winning ticket per thousand, which we know by comparing one-in-eight to one-in-a-billion.
这就是贝叶斯论证的核心。从过去的假设出发进行正向推理,为我们之后逆向推导出最可能的假设奠定了基础。
This is the crux of Bayes’s argument. Reasoning forward from hypothetical pasts lays the foundation for us to then work backward to the most probable one.
这是一种巧妙而创新的方法,但它未能为抽奖问题提供完整的答案。在向皇家学会提交贝叶斯结果时,普莱斯成功证明,如果你购买了一张抽奖券,并且中奖了,那么至少一半的彩票中奖的概率是75%。然而,思考概率的概率可能会让人有点头晕目眩。而且,如果有人追问:“好吧,但你认为抽奖的赔率实际上是多少?”我们仍然不知道该如何回答。
It was an ingenious and innovative approach, but it did not manage to provide a full answer to the raffle problem. In presenting Bayes’s results to the Royal Society, Price was able to establish that if you buy a single raffle ticket and it’s a winner, then there’s a 75% chance that at least half the tickets are winners. But thinking about the probabilities of probabilities can get a bit head-spinning. What’s more, if someone pressed us, “Well, fine, but what do you think the raffle odds actually are?” we still wouldn’t know what to say.
这个问题的答案——如何将所有可能的假设提炼为一个特定的期望——几年后才被法国数学家皮埃尔-西蒙·拉普拉斯发现。
The answer to this question—how to distill all the various possible hypotheses into a single specific expectation—would be discovered only a few years later, by the French mathematician Pierre-Simon Laplace.
拉普拉斯定律
Laplace’s Law
拉普拉斯于1749年出生于诺曼底,他的父亲送他去一所天主教学校,希望他能成为神职人员。拉普拉斯后来在卡昂大学学习神学,但与毕生致力于精神和科学信仰的贝叶斯不同,他最终完全放弃了神职,转而投身数学。
Laplace was born in Normandy in 1749, and his father sent him to a Catholic school with the intent that he join the clergy. Laplace went on to study theology at the University of Caen, but unlike Bayes—who balanced spiritual and scientific devotions his whole life—he ultimately abandoned the cloth entirely for mathematics.
1774年,拉普拉斯完全不知道贝叶斯之前的研究成果,发表了一篇雄心勃勃的论文,名为《事件原因概率论》。在这篇论文中,拉普拉斯终于解决了如何从观察到的结果反向推断其可能原因的问题。
In 1774, completely unaware of the previous work by Bayes, Laplace published an ambitious paper called “Treatise on the Probability of the Causes of Events.” In it, Laplace finally solved the problem of how to make inferences backward from observed effects to their probable causes.
正如我们所见,贝叶斯找到了一种比较不同假设相对概率的方法。但在抽奖活动中,假设的数量实际上是无限的:每种可能的中奖比例都对应一种假设。拉普拉斯运用微积分——这门曾经备受争议的数学,贝叶斯曾是其重要的捍卫者——证明了如此广泛的可能性可以归结为一个估计值,而且是一个极其简洁的估计值。他证明,如果我们事先对抽奖活动一无所知,那么在第一次尝试抽出一张中奖彩票后,我们应该预期整个彩票池中的中奖比例恰好是2/3。如果我们购买三张彩票,并且全部中奖,那么预期中奖比例恰好是4/5。事实上,对于任何可能在n次尝试中抽出w张中奖彩票的情况,期望值就是中奖次数加一除以尝试次数加二:( w +1) ⁄ ( n +2)。
Bayes, as we saw, had found a way to compare the relative probability of one hypothesis to another. But in the case of a raffle, there is literally an infinite number of hypotheses: one for every conceivable proportion of winning tickets. Using calculus, the once-controversial mathematics of which Bayes had been an important defender, Laplace was able to prove that this vast spectrum of possibilities could be distilled down to a single estimate, and a stunningly concise one at that. If we really know nothing about our raffle ahead of time, he showed, then after drawing a winning ticket on our first try we should expect that the proportion of winning tickets in the whole pool is exactly 2/3. If we buy three tickets and all of them are winners, the expected proportion of winning tickets is exactly 4/5. In fact, for any possible drawing of w winning tickets in n attempts, the expectation is simply the number of wins plus one, divided by the number of attempts plus two: (w+1)⁄(n+2).
这种估算概率的极其简单的方案被称为拉普拉斯定律,它很容易应用于任何需要根据事件历史来评估其发生概率的情况。如果你尝试了十次,其中五次成功,拉普拉斯定律估计你的总体成功概率为 6/12 或 50%,这与我们的直觉一致。如果你只尝试一次就成功了,拉普拉斯估计的 2/3 比假设你每次都能成功更合理,也比普莱斯的指导(它告诉我们,存在 75% 的元概率,即 50% 或更高的成功概率)更具可操作性。
This incredibly simple scheme for estimating probabilities is known as Laplace’s Law, and it is easy to apply in any situation where you need to assess the chances of an event based on its history. If you make ten attempts at something and five of them succeed, Laplace’s Law estimates your overall chances to be 6/12 or 50%, consistent with our intuitions. If you try only once and it works out, Laplace’s estimate of 2/3 is both more reasonable than assuming you’ll win every time, and more actionable than Price’s guidance (which would tell us that there is a 75% metaprobability of a 50% or greater chance of success).
拉普拉斯继续将他的统计方法应用于当时的一系列问题,包括评估婴儿出生时性别是否真的平等。(他几乎可以肯定地证实,男性婴儿的出生概率实际上略高于女性婴儿。)他还撰写了《概率哲学论文》,该书可以说是第一本面向大众读者的概率论著作,至今仍是最好的著作之一,阐述了他的理论,并探讨了其在法律、科学和日常生活中的应用。
Laplace went on to apply his statistical approach to a wide range of problems of his time, including assessing whether babies are truly equally likely to be born male or female. (He established, to a virtual certainty, that male infants are in fact slightly more likely than female ones.) He also wrote the Philosophical Essay on Probabilities, arguably the first book about probability for a general audience and still one of the best, laying out his theory and considering its applications to law, the sciences, and everyday life.
拉普拉斯定律为我们提供了在现实世界中处理小数据的第一条简单的经验法则。即使我们只做了几次观察——或者只有一次——它也为我们提供实用的指导。想要计算你乘坐的公交车晚点的概率吗?你的垒球队获胜的概率吗?计算过去发生的次数加一,然后除以机会数加二。拉普拉斯定律的美妙之处在于,无论我们有一个数据点还是数百万个数据点,它都同样有效。小安妮相信明天太阳会升起是有道理的,它告诉我们:地球已经连续看到太阳升起大约 1.6 万亿天,下一次“尝试”再次日出的概率几乎与 100% 没有区别。
Laplace’s Law offers us the first simple rule of thumb for confronting small data in the real world. Even when we’ve made only a few observations—or only one—it offers us practical guidance. Want to calculate the chance your bus is late? The chance your softball team will win? Count the number of times it has happened in the past plus one, then divide by the number of opportunities plus two. And the beauty of Laplace’s Law is that it works equally well whether we have a single data point or millions of them. Little Annie’s faith that the sun will rise tomorrow is justified, it tells us: with an Earth that’s seen the sun rise for about 1.6 trillion days in a row, the chance of another sunrise on the next “attempt” is all but indistinguishable from 100%.
贝叶斯规则与先验信念
Bayes’s Rule and Prior Beliefs
所有这些假设都是一致且可理解的。我们为什么要优先考虑一个并不比其他假设更一致、更可理解的假设呢?
All these suppositions are consistent and conceivable. Why should we give the preference to one, which is no more consistent or conceivable than the rest?
—大卫·休谟
—DAVID HUME
拉普拉斯还考虑了贝叶斯论证的另一个修改,这个修改后来被证明至关重要:如何处理那些比其他假设更可能发生的假设。例如,虽然彩票可能会向99%的购票者发放奖金,但更有可能的是——我们假设——他们只会向1%的人发放奖金。这个假设应该反映在我们的估算中。
Laplace also considered another modification to Bayes’s argument that would prove crucial: how to handle hypotheses that are simply more probable than others. For instance, while it’s possible that a lottery might give away prizes to 99% of the people who buy tickets, it’s more likely—we’d assume—that they would give away prizes to only 1%. That assumption should be reflected in our estimates.
为了更具体一点,假设一位朋友给你看两枚不同的硬币。一枚是普通的“公平”硬币,正面和反面的概率各占一半;另一枚是双头硬币。他把两枚硬币扔进一个袋子里,然后随机抽出一枚。他抛了一次:正面。你觉得你的朋友抛的是哪一枚?
To make things concrete, let’s say a friend shows you two different coins. One is a normal, “fair” coin with a 50–50 chance of heads and tails; the other is a two-headed coin. He drops them into a bag and then pulls one out at random. He flips it once: heads. Which coin do you think your friend flipped?
贝叶斯的逆向推导方法可以快速解答这个问题。抛掷一枚公平硬币正面朝上的概率为 50%,而抛掷一枚双面硬币正面朝上的概率为 100%。因此,我们可以自信地断言,朋友掷出双面硬币的概率是100% ⁄ 50%,或者说,概率恰好是双面硬币的两倍。
Bayes’s scheme of working backward makes short work of this question. A flip coming up heads happens 50% of the time with a fair coin and 100% of the time with a two-headed coin. Thus we can assert confidently that it’s 100%⁄50%, or exactly twice as probable, that the friend had pulled out the two-headed coin.
现在考虑以下情况。这次,朋友给你看了九枚公平硬币和一枚双面硬币,把所有十枚硬币放进一个袋子里,随机抽取一枚,然后抛出:正面。现在你猜怎么着?是公平硬币还是双面硬币?
Now consider the following twist. This time, the friend shows you nine fair coins and one two-headed coin, puts all ten into a bag, draws one at random, and flips it: heads. Now what do you suppose? Is it a fair coin or the two-headed one?
拉普拉斯的研究预见到了这个问题,而答案同样简单得令人惊叹。和之前一样,一枚公平硬币正面朝上的概率恰好是双头硬币的一半。但现在,一枚公平硬币被取出的概率也恰好是双头硬币的九倍。事实证明,我们可以将这两个不同的考虑因素相乘:你的朋友拿着一枚公平硬币的可能性恰好是双头硬币的四倍半。
Laplace’s work anticipated this wrinkle, and here again the answer is impressively simple. As before, a fair coin is exactly half as likely to come up heads as a two-headed coin. But now, a fair coin is also nine times as likely to have been drawn in the first place. It turns out that we can just take these two different considerations and multiply them together: it is exactly four and a half times more likely that your friend is holding a fair coin than the two-headed one.
描述这种关系的数学公式将我们先前持有的观点与眼前的证据联系在一起,后来被称为贝叶斯规则——讽刺的是,真正重要的工作是由拉普拉斯完成的。它为如何将先前存在的信念与观察到的证据结合起来的问题提供了一个非常简单的解决方案:将它们的概率相乘。
The mathematical formula that describes this relationship, tying together our previously held ideas and the evidence before our eyes, has come to be known—ironically, as the real heavy lifting was done by Laplace—as Bayes’s Rule. And it gives a remarkably straightforward solution to the problem of how to combine preexisting beliefs with observed evidence: multiply their probabilities together.
值得注意的是,一些先入为主的信念对于这个公式的有效性至关重要。如果你的朋友径直走到你面前,对你说:“我从这个袋子里抛出一枚硬币,正面朝上。你认为这是一枚公平硬币的可能性有多大?”除非你至少知道袋子里有什么硬币,否则你根本无法回答这个问题。(如果你不知道其中一个概率,就无法将这两个概率相乘。)这种在抛硬币前“袋子里”有什么的感知——在你看到任何数据之前,每个假设成立的概率——被称为先验概率,简称“先验”。贝叶斯规则总是需要你有一些先验知识,即使只是猜测。有多少枚双头硬币?它们有多容易获得?你的朋友到底有多会耍花招?
Notably, having some preexisting beliefs is crucial for this formula to work. If your friend simply approached you and said, “I flipped one coin from this bag and it came up heads. How likely do you think it is that this is a fair coin?,” you would be totally unable to answer that question unless you had at least some sense of what coins were in the bag to begin with. (You can’t multiply the two probabilities together when you don’t have one of them.) This sense of what was “in the bag” before the coin flip—the chances for each hypothesis to have been true before you saw any data—is known as the prior probabilities, or “prior” for short. And Bayes’s Rule always needs some prior from you, even if it’s only a guess. How many two-headed coins exist? How easy are they to get? How much of a trickster is your friend, anyway?
贝叶斯规则依赖于先验知识,这一事实在历史上某些时期曾被认为是有争议的、有偏见的,甚至是不科学的。但实际上,我们很少会陷入一个完全陌生的境地,以至于大脑一片空白——我们很快就会回到那种状态。
The fact that Bayes’s Rule is dependent on the use of priors has at certain points in history been considered controversial, biased, even unscientific. But in reality, it is quite rare to go into a situation so totally unfamiliar that our mind is effectively a blank slate—a point we’ll return to momentarily.
与此同时,当你对先验概率有一定的估计时,贝叶斯规则适用于各种各样的预测问题,无论是大数据类型的,还是更常见的小数据类型的。计算抽奖或掷出正面的概率仅仅是个开始。贝叶斯和拉普拉斯开发的方法可以在任何不确定的情况下提供帮助,并且只需要处理少量数据。而这正是我们在尝试预测未来时所面临的情况。
When you do have some estimate of prior probabilities, meanwhile, Bayes’s Rule applies to a wide range of prediction problems, be they of the big-data variety or the more common small-data sort. Computing the probability of winning a raffle or tossing heads is only the beginning. The methods developed by Bayes and Laplace can offer help any time you have uncertainty and a bit of data to work with. And that’s exactly the situation we face when we try to predict the future.
哥白尼原理
The Copernican Principle
做出预测很困难,尤其是关于未来的预测。
It’s difficult to make predictions, especially about the future.
—丹麦谚语
—DANISH PROVERB
当J·理查德·戈特抵达柏林墙时,他问了自己一个非常简单的问题:我在哪里?也就是说,在这件器物的全部生命周期中,我究竟到达了哪里?某种程度上,他提出的是四百年前天文学家尼古拉·哥白尼痴迷的空间问题的时间版本:我们在哪里?地球在宇宙的哪个位置?哥白尼将做出彻底的范式转变,认为地球并非宇宙的中心——事实上,它并没有什么特别之处。戈特决定在时间问题上采取同样的步骤。
When J. Richard Gott arrived at the Berlin Wall, he asked himself a very simple question: Where am I? That is to say, where in the total life span of this artifact have I happened to arrive? In a way, he was asking the temporal version of the spatial question that had obsessed the astronomer Nicolaus Copernicus four hundred years earlier: Where are we? Where in the universe is the Earth? Copernicus would make the radical paradigm shift of imagining that the Earth was not the bull’s-eye center of the universe—that it was, in fact, nowhere special in particular. Gott decided to take the same step with regard to time.
他假设自己遇见柏林墙的那一刻并不特殊——它出现在柏林墙存在的任何时刻都同样有可能。如果任何时刻出现的可能性都同样大,那么平均而言,他到达的时间应该恰好是柏林墙倒塌过程的一半(因为在一半之前倒塌的可能性为 50%,在一半之后倒塌的可能性为 50%)。更一般地说,除非我们了解得更清楚,否则我们只能预期自己恰好出现在任何特定现象持续时间的一半。*如果我们假设自己恰好出现在某事物持续时间的一半,那么我们对它将持续多久的最佳猜测就显而易见了:恰好和它已经持续的时间一样长。戈特在柏林墙建成八年后才看到它,所以他的最佳猜测是它还会再屹立八年。(最终猜测是二十年。)
He made the assumption that the moment when he encountered the Berlin Wall wasn’t special—that it was equally likely to be any moment in the wall’s total lifetime. And if any moment was equally likely, then on average his arrival should have come precisely at the halfway point (since it was 50% likely to fall before halfway and 50% likely to fall after). More generally, unless we know better we can expect to have shown up precisely halfway into the duration of any given phenomenon.* And if we assume that we’re arriving precisely halfway into something’s duration, the best guess we can make for how long it will last into the future becomes obvious: exactly as long as it’s lasted already. Gott saw the Berlin Wall eight years after it was built, so his best guess was that it would stand for eight years more. (It ended up being twenty.)
这种直截了当的推理被戈特称为哥白尼原理,它产生一种简单的算法,可用于预测各种主题。在没有任何先入为主的期望的情况下,我们可以用它来预测柏林墙的倒塌时间,以及其他许多短期和长期现象的倒塌时间。哥白尼原理预测,美利坚合众国将作为一个国家持续到大约 2255 年,谷歌将持续到大约 2032 年,而你朋友一个月前开始的恋情可能还会持续一个月左右(也许可以告诉他不要急着回复那份婚礼请柬)。同样,它告诉我们要保持怀疑态度,例如,当最近的《纽约客》封面描绘了一个男人拿着一部六英寸智能手机,上面有我们熟悉的方形应用程序图标网格,标题写着“2525”时。令人怀疑。我们所知的智能手机才诞生不到十年,而哥白尼原理告诉我们,它很可能在2025年就不存在了,更别说五个世纪之后了。到2525年,如果还有纽约市,那也只是个小惊喜。
This straightforward reasoning, which Gott named the Copernican Principle, results in a simple algorithm that can be used to make predictions about all sorts of topics. Without any preconceived expectations, we might use it to obtain predictions for the end of not only the Berlin Wall but any number of other short- and long-lived phenomena. The Copernican Principle predicts that the United States of America will last as a nation until approximately the year 2255, that Google will last until roughly 2032, and that the relationship your friend began a month ago will probably last about another month (maybe tell him not to RSVP to that wedding invitation just yet). Likewise, it tells us to be skeptical when, for instance, a recent New Yorker cover depicts a man holding a six-inch smartphone with a familiar grid of square app icons, and the caption reads “2525.” Doubtful. The smartphone as we know it is barely a decade old, and the Copernican Principle tells us that it isn’t likely to be around in 2025, let alone five centuries later. By 2525 it’d be mildly surprising if there were even a New York City.
更实际的例子是,如果我们考虑去一个建筑工地工作,而工地的标识牌上写着“自上次工业事故发生以来已经过去了7天”,我们可能就不想去了,除非我们计划做的是短期工作。如果市政交通系统负担不起那些非常有用但价格昂贵的实时标识来告诉乘客下一班公交车何时到达,那么哥白尼原理表明,或许存在一种更简单、更便宜的替代方案。只需显示上一班公交车到达该站点的时间,就能清楚地提示下一班公交车何时到达。
More practically, if we’re considering employment at a construction site whose signage indicates that it’s been “7 days since the last industrial accident,” we might want to stay away, unless it’s a particularly short job we plan to do. And if a municipal transit system cannot afford the incredibly useful but expensive real-time signs that tell riders when the next bus is going to arrive, the Copernican Principle suggests that there might be a dramatically simpler and cheaper alternative. Simply displaying how long it’s been since the previous bus arrived at that stop offers a substantial hint about when the next one will.
但哥白尼原理真的正确吗?戈特在《自然》杂志上发表他的猜想后,该期刊收到了大量批评性信件。如果我们尝试将这条规则应用到一些更常见的例子上,就不难理解其中的原因了。如果你遇到一位90岁的老人,哥白尼原理预测他将活到180岁。与此同时,每个6岁的男孩都预测会在12岁时夭折。
But is the Copernican Principle right? After Gott published his conjecture in Nature, the journal received a flurry of critical correspondence. And it’s easy to see why when we try to apply the rule to some more familiar examples. If you meet a 90-year-old man, the Copernican Principle predicts he will live to 180. Every 6-year-old boy, meanwhile, is predicted to face an early death at the tender age of 12.
要理解哥白尼原理为何有效,以及它为何有时无效,我们需要回到贝叶斯。因为尽管哥白尼原理看似简单,但它实际上是贝叶斯规则的一个实例。
To understand why the Copernican Principle works, and why it sometimes doesn’t, we need to return to Bayes. Because despite its apparent simplicity, the Copernican Principle is really an instance of Bayes’s Rule.
贝叶斯遇见哥白尼
Bayes Meets Copernicus
在预测未来时,例如预测柏林墙的寿命,我们需要评估的假设是该现象所有可能的持续时间:它会持续一周、一个月、一年还是十年?正如我们所见,要应用贝叶斯规则,我们首先需要为每个持续时间分配一个先验概率。事实证明,哥白尼原理正是通过应用贝叶斯规则,利用所谓的无信息先验所得到的结果。
When predicting the future, such as the longevity of the Berlin Wall, the hypotheses we need to evaluate are all the possible durations of the phenomenon at hand: will it last a week, a month, a year, a decade? To apply Bayes’s Rule, as we have seen, we first need to assign a prior probability to each of these durations. And it turns out that the Copernican Principle is exactly what results from applying Bayes’s Rule using what is known as an uninformative prior.
乍一看,这似乎自相矛盾。如果贝叶斯规则总是要求我们明确说明先验预期和信念,我们又怎么能告诉它我们没有任何先验预期和信念呢?以抽奖为例,一种辩解无知的方式是假设所谓的“均匀先验”,即认为所有中奖比例的可能性都相同。*以柏林墙为例,无信息先验意味着我们对试图预测的时间跨度一无所知:柏林墙可能在接下来的五分钟内倒塌,也可能持续五千年。
At first this may seem like a contradiction in terms. If Bayes’s Rule always requires us to specify our prior expectations and beliefs, how could we tell it that we don’t have any? In the case of a raffle, one way to plead ignorance would be to assume what’s called the “uniform prior,” which considers every proportion of winning tickets to be equally likely.* In the case of the Berlin Wall, an uninformative prior means saying that we don’t know anything about the time span we’re trying to predict: the wall could equally well come down in the next five minutes or last for five millennia.
除了那个毫无意义的先验知识之外,正如我们所见,我们提供给贝叶斯规则的唯一数据就是我们遇到的柏林墙,当时它已经建成八年了。因此,任何预测柏林墙寿命少于八年的假设都会被立即排除,因为这些假设根本无法解释我们的情况。(同样,一枚双面硬币,只要出现反面,就被排除。)任何超过八年的情况都有可能——但如果柏林墙要存在一百万年,那么我们恰好在它存在之初就撞上它,那将是一个天大的巧合。因此,即使不能排除柏林墙寿命极长的可能性,但这种可能性也并非很大。
Aside from that uninformative prior, the only piece of data we supply to Bayes’s Rule, as we’ve seen, is the fact that we’ve encountered the Berlin Wall when it is eight years old. Any hypothesis that would have predicted a less than eight-year life span for the wall is thereby ruled out immediately, since those hypotheses can’t account for our situation at all. (Similarly, a two-headed coin is ruled out by the first appearance of tails.) Anything longer than eight years is within the realm of possibility—but if the wall were going to be around for a million years, it would be a big coincidence that we happened to bump into it so very close to the start of its existence. Therefore, even though enormously long life spans cannot be ruled out, neither are they very likely.
当贝叶斯规则将所有这些概率结合起来时——可能性较大的短时间跨度会压低平均预测值,可能性较小但仍然可能的长时间跨度会抬高平均预测值——哥白尼原理就出现了:如果我们想预测某件事会持续多久,而对它一无所知,那么我们能做出的最佳猜测就是,只要它已经持续了,它就会一直持续下去。
When Bayes’s Rule combines all these probabilities—the more-probable short time spans pushing down the average forecast, the less-probable yet still possible long ones pushing it up—the Copernican Principle emerges: if we want to predict how long something will last, and have no other knowledge about it whatsoever, the best guess we can make is that it will continue just as long as it’s gone on so far.
事实上,戈特甚至不是第一个提出类似哥白尼原理的人。早在20世纪中叶,贝叶斯统计学家哈罗德·杰弗里斯就曾研究过,仅给定一辆有轨电车的序列号,就能确定城市中有多少辆有轨电车,他得出的答案是一样的:将序列号翻倍。类似的问题甚至更早也出现过,在二战期间,盟军试图估算德国生产的坦克数量。基于缴获坦克序列号的纯数学估算预测,德国每月生产坦克246辆,而通过广泛(且风险极高)的空中侦察获得的估计数字则表明,实际生产数量更像是1400辆。战后,德国的记录揭示了真实数字:245辆。
In fact, Gott wasn’t even the first to propose something like the Copernican Principle. In the mid-twentieth century, the Bayesian statistician Harold Jeffreys had looked into determining the number of tramcars in a city given the serial number on just one tramcar, and came up with the same answer: double the serial number. And a similar problem had arisen even earlier, during World War II, when the Allies sought to estimate the number of tanks being produced by Germany. Purely mathematical estimates based on captured tanks’ serial numbers predicted that the Germans were producing 246 tanks every month, while estimates obtained by extensive (and highly risky) aerial reconnaissance suggested the figure was more like 1,400. After the war, German records revealed the true figure: 245.
认识到哥白尼原理不过是贝叶斯规则加上一个毫无根据的先验信息,就能解答很多关于其有效性的问题。哥白尼原理在我们一无所知的情况下显得合理——比如,当我们回顾1969年的柏林墙时,我们甚至不确定哪个时间尺度才是合适的。而当我们对相关主题有所了解时,它却感觉完全错误。预测一个90岁的老人能活到180岁似乎并不合理,正是因为我们在研究这个问题时已经对人类的寿命有了充分的了解——因此我们可以做得更好。我们为贝叶斯规则提供的先验信息越丰富,我们从中得到的预测就越有用。
Recognizing that the Copernican Principle is just Bayes’s Rule with an uninformative prior answers a lot of questions about its validity. The Copernican Principle seems reasonable exactly in those situations where we know nothing at all—such as looking at the Berlin Wall in 1969, when we’re not even sure what timescale is appropriate. And it feels completely wrong in those cases where we do know something about the subject matter. Predicting that a 90-year-old man will live to 180 years seems unreasonable precisely because we go into the problem already knowing a lot about human life spans—and so we can do better. The richer the prior information we bring to Bayes’s Rule, the more useful the predictions we can get out of it.
现实世界的先验……
Real-World Priors …
从最广泛的意义上讲,世界上有两种类型的事物:倾向于(或聚集在)某种“自然”价值的事物,以及不倾向于(或聚集在)某种“自然”价值的事物。
In the broadest sense, there are two types of things in the world: things that tend toward (or cluster around) some kind of “natural” value, and things that don’t.
人类的寿命显然属于前者。它们大致遵循所谓的“正态”分布——也称为“高斯”分布,以德国数学家卡尔·弗里德里希·高斯命名,因其特征形状而被非正式地称为“钟形曲线”。这种形状很好地描述了人类的寿命;例如,美国男性的平均寿命集中在76岁左右,概率向两侧急剧下降。正态分布往往只有一个合适的尺度:一位数的寿命被认为是悲惨的,三位数的寿命被认为是非凡的。自然界中的许多其他事物也呈正态分布,从人类的身高、体重和血压到城市正午的温度和果园里水果的直径。
Human life spans are clearly in the former category. They roughly follow what’s termed a “normal” distribution—also known as the “Gaussian” distribution, after the German mathematician Carl Friedrich Gauss, and informally called the “bell curve” for its characteristic shape. This shape does a good job of characterizing human life spans; the average life span for men in the United States, for instance, is centered at about 76 years, and the probabilities fall off fairly sharply to either side. Normal distributions tend to have a single appropriate scale: a one-digit life span is considered tragic, a three-digit one extraordinary. Many other things in the natural world are normally distributed as well, from human height, weight, and blood pressure to the noontime temperature in a city and the diameter of fruits in an orchard.
然而,世界上有很多事物看起来并不符合正态分布——远非如此。例如,美国一个城镇的平均人口为 8,226 人。但如果你制作一个按人口数量划分的城镇数量图表,你不会看到任何类似钟形曲线的东西。人口小于 8,226 的城镇数量会远远多于人口大于 8,226 的城镇。同时,人口较大的城镇会比平均水平大得多。这种模式就是所谓的“幂律分布”。幂律分布也被称为“无标度分布”,因为它们表征的数量可以在许多尺度上合理地分布:一个城镇可能有几十、几百、几千、几万、几十万或几百万居民,所以我们无法确定一个“正常”城镇应该有多大。
There are a number of things in the world that don’t look normally distributed, however—not by a long shot. The average population of a town in the United States, for instance, is 8,226. But if you were to make a graph of the number of towns by population, you wouldn’t see anything remotely like a bell curve. There would be way more towns smaller than 8,226 than larger. At the same time, the larger ones would be way bigger than the average. This kind of pattern typifies what are called “power-law distributions.” These are also known as “scale-free distributions” because they characterize quantities that can plausibly range over many scales: a town can have tens, hundreds, thousands, tens of thousands, hundreds of thousands, or millions of residents, so we can’t pin down a single value for how big a “normal” town should be.
幂律分布刻画了日常生活中许多与城镇人口具有相同基本特征的现象:大多数低于平均值,少数则高于平均值。电影票房收入从四位数到十位数不等,是另一个例子。大多数电影根本赚不了多少钱,但偶尔会有一部《泰坦尼克号》赚得盆满钵满。
The power-law distribution characterizes a host of phenomena in everyday life that have the same basic quality as town populations: most things below the mean, and a few enormous ones above it. Movie box-office grosses, which can range from four to ten figures, are another example. Most movies don’t make much money at all, but the occasional Titanic makes … well, titanic amounts.
事实上,金钱总体上是一个充满幂律的领域。幂律分布既表征了人们的财富,也表征了人们的收入。例如,美国的平均收入为55,688美元——但由于收入大致呈幂律分布,我们再次知道,低于这一平均水平的人会比高于这一平均水平的人多得多,而高于这一平均水平的人可能收入水平极高。因此,三分之二的美国人口收入低于平均水平,但最富有的1%的收入几乎是平均水平的十倍。而这1%中最富有的1 %的收入更是平均水平的十倍。
In fact, money in general is a domain full of power laws. Power-law distributions characterize both people’s wealth and people’s incomes. The mean income in America, for instance, is $55,688—but because income is roughly power-law distributed, we know, again, that many more people will be below this mean than above it, while those who are above might be practically off the charts. So it is: two-thirds of the US population make less than the mean income, but the top 1% make almost ten times the mean. And the top 1% of the 1% make ten times more than that.
人们常哀叹“富者愈富”,而“优先连接”的过程正是产生幂律分布的最可靠途径之一。最受欢迎的网站最有可能获得链接;粉丝最多的网红最有可能获得新粉丝;最负盛名的公司最有可能吸引新客户;最大的城市最有可能吸引新居民。在每种情况下,都会产生幂律分布。
It’s often lamented that “the rich get richer,” and indeed the process of “preferential attachment” is one of the surest ways to produce a power-law distribution. The most popular websites are the most likely to get incoming links; the most followed online celebrities are the ones most likely to gain new fans; the most prestigious firms are the ones most likely to attract new clients; the biggest cities are the ones most likely to draw new residents. In every case, a power-law distribution will result.
贝叶斯规则告诉我们,当基于有限的证据进行预测时,没有什么比拥有良好的先验知识更重要——也就是说,了解我们预期证据将来自哪个分布。因此,良好的预测始于对何时是正态分布、何时是幂律分布有良好的直觉。事实证明,贝叶斯规则为我们提供了一条简单但截然不同的预测经验法则。
Bayes’s Rule tells us that when it comes to making predictions based on limited evidence, few things are as important as having good priors—that is, a sense of the distribution from which we expect that evidence to have come. Good predictions thus begin with having good instincts about when we’re dealing with a normal distribution and when with a power-law distribution. As it turns out, Bayes’s Rule offers us a simple but dramatically different predictive rule of thumb for each.
及其预测规则
… and Their Prediction Rules
你的意思是“这种情况可以永远持续下去”是好的吗?
Did you mean “this could go on forever” in a good way?
—本·勒纳
—BEN LERNER
通过考察哥白尼原理,我们发现,当贝叶斯规则被赋予一个无信息的先验概率时,它总是预测一个物体的总寿命恰好是其当前年龄的两倍。事实上,无信息的先验概率,其可能的尺度千差万别——这堵墙可能持续数月或数千年——是一个幂律分布。对于任何幂律分布,贝叶斯规则表明,合适的预测策略是乘法规则:将迄今为止观察到的量乘以某个常数因子。对于无信息的先验概率,该常数因子恰好是2,因此是哥白尼预测;在其他幂律情况下,乘数将取决于你所使用的具体分布。例如,对于电影票房,它恰好是1.4左右。所以,如果你听说一部电影迄今为止的票房收入为600万美元,你可以猜测它的总票房收入约为840万美元;如果它的票房收入为9000万美元,你猜测它的最高票房收入将达到1.26亿美元。
Examining the Copernican Principle, we saw that when Bayes’s Rule is given an uninformative prior, it always predicts that the total life span of an object will be exactly double its current age. In fact, the uninformative prior, with its wildly varying possible scales—the wall that might last for months or for millennia—is a power-law distribution. And for any power-law distribution, Bayes’s Rule indicates that the appropriate prediction strategy is a Multiplicative Rule: multiply the quantity observed so far by some constant factor. For an uninformative prior, that constant factor happens to be 2, hence the Copernican prediction; in other power-law cases, the multiplier will depend on the exact distribution you’re working with. For the grosses of movies, for instance, it happens to be about 1.4. So if you hear a movie has made $6 million so far, you can guess it will make about $8.4 million overall; if it’s made $90 million, guess it will top out at $126 million.
乘法规则的直接原因是幂律分布没有为其所描述的现象指定一个自然尺度。因此,唯一能让我们预测时具有尺度感的是我们拥有的单个数据点——例如柏林墙已经矗立了八年。该单个数据点的值越大,我们处理的尺度可能就越大,反之亦然。一部票房收入600万美元的电影可能在上映的第一个小时就成为一部大片,但它更有可能只是一部票房收入只有几百万的电影。
This multiplicative rule is a direct consequence of the fact that power-law distributions do not specify a natural scale for the phenomenon they’re describing. The only thing that gives us a sense of scale for our prediction, therefore, is the single data point we have—such as the fact that the Berlin Wall has stood for eight years. The larger the value of that single data point, the larger the scale we’re probably dealing with, and vice versa. It’s possible that a movie that’s grossed $6 million is actually a blockbuster in its first hour of release, but it’s far more likely to be just a single-digit-millions kind of movie.
另一方面,当我们将贝叶斯规则应用于正态分布作为先验时,我们会获得一种截然不同的指导。我们得到的不是乘法规则,而是平均规则:使用分布的“自然”平均值——其单一、特定的尺度——作为指导。例如,如果某人的寿命小于平均寿命,那么只需预测平均值即可;随着他们的年龄接近并超过平均值,预测他们会多活几年。遵循这条规则,可以对90岁和6岁儿童做出合理的预测:分别为94岁和77岁。(6岁儿童由于度过了婴儿期,因此比76岁的人口平均值略高:我们知道他不在分布的左尾。)
When we apply Bayes’s Rule with a normal distribution as a prior, on the other hand, we obtain a very different kind of guidance. Instead of a multiplicative rule, we get an Average Rule: use the distribution’s “natural” average—its single, specific scale—as your guide. For instance, if somebody is younger than the average life span, then simply predict the average; as their age gets close to and then exceeds the average, predict that they’ll live a few years more. Following this rule gives reasonable predictions for the 90-year-old and the 6-year-old: 94 and 77, respectively. (The 6-year-old gets a tiny edge over the population average of 76 by virtue of having made it through infancy: we know he’s not in the distribution’s left tail.)
电影放映时长,如同人的一生,也遵循正态分布:大多数电影的放映时长集中在一百分钟左右,少数例外情况则向左右两侧递减。但并非所有人类活动都如此规律。诗人迪安·杨曾说过,每当他听一首按编号分段的诗歌时,如果读者宣布从第四部分开始,他的心情就会一沉;如果诗歌超过三个部分,一切就都无从谈起,杨就需要专心听下去了。事实证明,杨的沮丧其实完全是贝叶斯分布的结果。对诗歌的分析表明,与电影放映时长不同,诗歌更接近幂律分布而非正态分布:大多数诗歌很短,但也有一些是史诗。所以,在欣赏诗歌时,一定要找个舒服的座位。正态分布的诗歌如果看起来持续时间过长,很快就会结束;但幂律分布的诗歌持续时间越长,你就能预期它持续的时间就越长。
Movie running times, like human lifetimes, also follow a normal distribution: most films cluster right around a hundred minutes or so, with diminishing numbers of exceptions tailing off to either side. But not all human activities are so well behaved. The poet Dean Young once remarked that whenever he’s listening to a poem in numbered sections, his heart sinks if the reader announces the start of section four: if there are more than three parts, all bets are off, and Young needs to hunker down for an earful. It turns out that Young’s dismay is, in fact, perfectly Bayesian. An analysis of poems shows that, unlike movie running times, poems follow something closer to a power-law than a normal distribution: most poems are short, but some are epics. So when it comes to poetry, make sure you’ve got a comfortable seat. Something normally distributed that’s gone on seemingly too long is bound to end shortly; but the longer something in a power-law distribution has gone on, the longer you can expect it to keep going.
在这两个极端之间,生活中实际上存在着第三类事物:那些不会因为持续了一段时间而增加或减少结束可能性的事物。有时,事物只是……不变的。研究此类现象的丹麦数学家阿格纳·克拉鲁普·埃尔朗(Agner Krarup Erlang)将独立事件之间间隔的分布形式化为一个以他的名字命名的函数:埃尔朗分布。该曲线的形状与正态分布和幂律分布均不同:它具有翼状轮廓,上升至平缓的驼峰,尾部下降的速度比幂律分布快,但比正态分布慢。埃尔朗本人在20世纪初为哥本哈根电话公司工作时,用它来模拟电话网络上连续通话之间预计的时间间隔。从那时起,埃尔朗分布也被城市规划师和建筑师用来模拟汽车和行人交通,也被网络工程师用来设计互联网基础设施。自然界中也存在许多领域,其中事件彼此完全独立,因此它们之间的间隔落在埃尔朗曲线上。放射性衰变就是一个例子,这意味着埃尔朗分布完美地模拟了盖革计数器下一次滴答声的预期时间。事实证明,它也能很好地描述某些人类活动——例如政客在众议院任职的时间。
Between those two extremes, there’s actually a third category of things in life: those that are neither more nor less likely to end just because they’ve gone on for a while. Sometimes things are simply … invariant. The Danish mathematician Agner Krarup Erlang, who studied such phenomena, formalized the spread of intervals between independent events into the function that now carries his name: the Erlang distribution. The shape of this curve differs from both the normal and the power-law: it has a winglike contour, rising to a gentle hump, with a tail that falls off faster than a power-law but more slowly than a normal distribution. Erlang himself, working for the Copenhagen Telephone Company in the early twentieth century, used it to model how much time could be expected to pass between successive calls on a phone network. Since then, the Erlang distribution has also been used by urban planners and architects to model car and pedestrian traffic, and by networking engineers designing infrastructure for the Internet. There are a number of domains in the natural world, too, where events are completely independent from one another and the intervals between them thus fall on an Erlang curve. Radioactive decay is one example, which means that the Erlang distribution perfectly models when to expect the next ticks of a Geiger counter. It also turns out to do a pretty good job of describing certain human endeavors—such as the amount of time politicians stay in the House of Representatives.
埃尔朗分布为我们提供了第三种预测规则——加法规则:始终预测事物将持续一个常数时间。“再过五分钟!……[五分钟后] 再过五分钟!”这句熟悉的口头禅,常常被用来描述人们关于何时准备离开家或办公室,或者距离完成某项任务还有多长时间的说法。这似乎表明人们长期以来无法做出切合实际的估计。好吧,无论如何,在与埃尔朗分布对抗的情况下,这句话恰好是正确的。
The Erlang distribution gives us a third kind of prediction rule, the Additive Rule: always predict that things will go on just a constant amount longer. The familiar refrain of “Just five more minutes!… [five minutes later] Five more minutes!” that so often characterizes human claims regarding, say, one’s readiness to leave the house or office, or the time until the completion of some task, may seem indicative of some chronic failure to make realistic estimates. Well, in the cases where one’s up against an Erlang distribution, anyway, that refrain happens to be correct.
比如,如果一个赌场牌迷告诉他不耐烦的妻子,再打一张黑杰克(赔率大约是 20 比 1)他今天就不玩了,他可能会兴高采烈地预测:“再打二十手就完事了!”如果二十手之后,她运气不好,回来问他现在还要让她等多久,他的回答还是一样:“再打二十手就完事了!”听起来我们这位不知疲倦的牌王好像得了短期记忆丧失——但事实上,他的预测完全正确。事实上,无论历史或当前状态如何,能得出相同预测的分布被统计学家称为“无记忆分布”。
If a casino card-playing enthusiast tells his impatient spouse, for example, that he’ll quit for the day after hitting one more blackjack (the odds of which are about 20 to 1), he might cheerily predict, “I’ll be done in about twenty more hands!” If, an unlucky twenty hands later, she returns, asking how long he’s going to make her wait now, his answer will be unchanged: “I’ll be done in about twenty more hands!” It sounds like our indefatigable card shark has suffered a short-term memory loss—but, in fact, his prediction is entirely correct. Indeed, distributions that yield the same prediction, no matter their history or current state, are known to statisticians as “memoryless.”
不同的先验分布及其预测规则。
Different prior distributions and their prediction rules.
这三种截然不同的最优预测模式——乘法规则、平均规则和加法规则——都是将贝叶斯规则分别应用于幂律分布、正态分布和厄尔朗分布而直接得出的。考虑到这些预测结果的不同,这三种分布也为我们提供了不同的指导,让我们了解应该对某些事件感到多惊讶。
These three very different patterns of optimal prediction—the Multiplicative, Average, and Additive Rules—all result directly from applying Bayes’s Rule to the power-law, normal, and Erlang distributions, respectively. And given the way those predictions come out, the three distributions offer us different guidance, too, on how surprised we should be by certain events.
在幂律分布中,某件事持续的时间越长,我们预期它还会持续更长时间。因此,我们等待幂律事件的时间越长,它就越令人惊讶——尤其是在它发生之前,这种惊讶程度达到了顶峰。一个国家、一个公司或一个机构只会随着时间的流逝而变得更加稳固,所以当它崩溃时总是令人震惊。
In a power-law distribution, the longer something has gone on, the longer we expect it to continue going on. So a power-law event is more surprising the longer we’ve been waiting for it—and maximally surprising right before it happens. A nation, corporation, or institution only grows more venerable with each passing year, so it’s always stunning when it collapses.
在正态分布中,事件发生得早会让人感到意外——因为我们预期它们会达到平均值——但发生得晚则不会。事实上,到那时,它们似乎已经过了该发生的时间,所以我们等待的时间越长,就越期待它们发生。
In a normal distribution, events are surprising when they’re early—since we expected them to reach the average—but not when they’re late. Indeed, by that point they seem overdue to happen, so the longer we wait, the more we expect them.
在埃尔朗分布中,事件根据定义无论何时发生都不会更令人惊讶或更不令人惊讶。任何事态无论持续多久,都有同等的可能性结束。难怪政客们总是在思考他们的下一次选举。
And in an Erlang distribution, events by definition are never any more or less surprising no matter when they occur. Any state of affairs is always equally likely to end regardless of how long it’s lasted. No wonder politicians are always thinking about their next election.
赌博也具有类似的稳态预期。比如说,如果你在轮盘赌中等待赢钱的时间服从正态分布,那么平均法则就适用了:在一连串的坏运气之后,它会告诉你你的号码应该随时都会出现,而且很可能接下来还会输很多次。(在这种情况下,继续等待下一次赢钱然后退出是合理的。)相反,如果等待赢钱的时间服从幂律分布,那么乘法法则会告诉你,赢钱的次数会很快接踵而至,但赢钱荒持续的时间越长,持续的时间可能就越长。(在这种情况下,你每次赢钱后都会继续玩一段时间,但连续输钱后就应该放弃。)然而,面对无记忆分布,你就束手无策了。加法法则告诉你,现在赢钱的概率与一小时前相同,与一小时后也相同。一切都不会改变。坚持到底并不会给你带来回报,也不会有一个临界点让你止损。肯尼·罗杰斯在《赌徒》中曾说过一句名言:“要知道何时该离开/何时该逃跑”——但对于无记忆分布来说,没有合适的退出时机。这或许可以部分解释这些游戏为何如此令人上瘾。
Gambling is characterized by a similar kind of steady-state expectancy. If your wait for, say, a win at the roulette wheel were characterized by a normal distribution, then the Average Rule would apply: after a run of bad luck, it’d tell you that your number should be coming any second, probably followed by more losing spins. (In that case, it’d make sense to press on to the next win and then quit.) If, instead, the wait for a win obeyed a power-law distribution, then the Multiplicative Rule would tell you that winning spins follow quickly after one another, but the longer a drought had gone on the longer it would probably continue. (In that scenario, you’d be right to keep playing for a while after any win, but give up after a losing streak.) Up against a memoryless distribution, however, you’re stuck. The Additive Rule tells you the chance of a win now is the same as it was an hour ago, and the same as it will be an hour from now. Nothing ever changes. You’re not rewarded for sticking it out and ending on a high note; neither is there a tipping point when you should just cut your losses. In “The Gambler,” Kenny Rogers famously advised that you’ve got to “Know when to walk away / Know when to run”—but for a memoryless distribution, there is no right time to quit. This may in part explain these games’ addictiveness.
了解你所面对的分布情况至关重要。当哈佛大学生物学家、多产的科普作家史蒂芬·杰伊·古尔德发现自己患了癌症时,他第一反应是去阅读相关的医学文献。后来,他才明白医生为什么不鼓励他这样做:患有这种癌症的患者,有一半在确诊后的八个月内就去世了。
Knowing what distribution you’re up against can make all the difference. When the Harvard biologist and prolific popularizer of science Stephen Jay Gould discovered that he had cancer, his immediate impulse was to read the relevant medical literature. Then he found out why his doctors had discouraged him from doing so: half of all patients with his form of cancer died within eight months of discovery.
但八个月这个统计数据并没有告诉他任何关于幸存者分布的信息。如果是正态分布,那么平均法则就能相当清楚地预测出他的预期寿命:大约八个月。但如果是幂律分布,尾部向右延伸很远,那么情况就大不相同了:乘法法则会告诉他,他活得越久,就越能证明他会活得更久。进一步阅读后,古尔德发现“分布确实严重右偏,长尾(无论多小)在八个月的中位数上方延伸了好几年。我找不到任何理由不在那条小尾部中,我长舒了一口气。”古尔德在确诊后又活了二十年。
But that one statistic—eight months—didn’t tell him anything about the distribution of survivors. If it were a normal distribution, then the Average Rule would give a pretty clear forecast of how long he could expect to live: about eight months. But if it were a power-law, with a tail that stretches far out to the right, then the situation would be quite different: the Multiplicative Rule would tell him that the longer he lived, the more evidence it would provide that he would live longer. Reading further, Gould discovered that “the distribution was indeed, strongly right skewed, with a long tail (however small) that extended for several years above the eight month median. I saw no reason why I shouldn’t be in that small tail, and I breathed a very long sigh of relief.” Gould would go on to live for twenty more years after his diagnosis.
小数据与思维
Small Data and the Mind
这三条预测规则——乘法、平均和加法——适用于各种日常情况。在这些情况下,人们通常非常擅长运用正确的预测规则。汤姆读研究生时,曾与麻省理工学院的乔什·特南鲍姆合作进行了一项实验,要求人们根据每一种情况中的一条信息,对各种日常量(例如人类寿命、电影票房以及美国众议员的任期)做出预测:当前年龄、迄今为止的收入以及迄今为止的任职年限。然后,他们将人们的预测与将贝叶斯规则应用于每个领域的实际数据后得出的预测进行了比较。
The three prediction rules—Multiplicative, Average, and Additive—are applicable in a wide range of everyday situations. And in those situations, people in general turn out to be remarkably good at using the right prediction rule. When he was in graduate school, Tom, along with MIT’s Josh Tenenbaum, ran an experiment asking people to make predictions for a variety of everyday quantities—such as human life spans, the grosses of movies, and the time that US representatives would spend in office—based on just one piece of information in each case: current age, money earned so far, and years served to date. Then they compared the predictions people made to the predictions given by applying Bayes’s Rule to the actual real-world data across each of those domains.
事实证明,人们做出的预测与贝叶斯规则的预测极其接近。直观地看,在现实世界中,人们对遵循不同分布(幂律分布、正态分布和厄尔兰分布)的量会做出不同类型的预测。换句话说,虽然你可能不知道或不记得哪种情况需要乘法、平均或加法规则,但你每天所做的预测往往隐含地反映了这些分布在日常生活中出现的不同情况及其不同的行为方式。
As it turned out, the predictions that people had made were extremely close to those produced by Bayes’s Rule. Intuitively, people made different types of predictions for quantities that followed different distributions—power-law, normal, and Erlang—in the real world. In other words, while you might not know or consciously remember which situation calls for the Multiplicative, Average, or Additive Rule, the predictions you make every day tend to implicitly reflect the different cases where these distributions appear in everyday life, and the different ways they behave.
鉴于我们对贝叶斯规则的了解,人类如此出色的表现揭示了一些至关重要的道理,有助于理解人类的预测方式。小数据其实是伪装的大数据。我们之所以能够凭借少量观察数据(甚至仅仅是一个观察数据)做出准确的预测,是因为我们拥有极其丰富的先验知识。无论我们是否意识到,我们似乎都拥有关于电影票房和放映时长、诗歌长度、政治任期,甚至人类寿命的惊人精准的先验知识。我们无需刻意收集这些信息,而是从世界中提取。
In light of what we know about Bayes’s Rule, this remarkably good human performance suggests something critical that helps to understand how people make predictions. Small data is big data in disguise. The reason we can often make good predictions from a small number of observations—or just a single one—is that our priors are so rich. Whether we know it or not, we appear to carry around in our heads surprisingly accurate priors about movie grosses and running times, poem lengths, and political terms of office, not to mention human life spans. We don’t need to gather them explicitly; we absorb them from the world.
总体而言,人们的直觉似乎与贝叶斯规则的预测高度吻合,这一事实也使得对各种先验分布进行逆向工程成为可能,即使是那些难以获得权威现实世界数据的先验分布。例如,被客服耽搁是人类经历中令人遗憾的常见现象,但目前还没有像好莱坞票房收入那样公开的等待时间数据集。但如果人们的预测是基于他们的经验,我们就可以利用贝叶斯规则,通过挖掘人们的预期来间接地侦察世界。当汤姆和乔希要求人们根据单个数据点预测等待时间时,结果表明他们的受试者使用了乘法规则:人们预期的总等待时间是他们迄今为止等待时间的1.3倍。这与幂律分布作为先验分布相一致,幂律分布的尺度范围很广。只希望你最终不会成为等待时间“泰坦尼克号”上的“泰坦尼克号”。在过去的十年中,这些方法使认知科学家能够识别人们在从视觉到语言等广泛领域的先验分布。
The fact that, on the whole, people’s hunches seem to closely match the predictions of Bayes’s Rule also makes it possible to reverse-engineer all kinds of prior distributions, even ones about which it’s harder to get authoritative real-world data. For instance, being kept on hold by customer service is a lamentably common facet of human experience, but there aren’t publicly available data sets on hold times the way there are for Hollywood box-office grosses. But if people’s predictions are informed by their experiences, we can use Bayes’s Rule to conduct indirect reconnaissance about the world by mining people’s expectations. When Tom and Josh asked people to predict hold times from a single data point, the results suggested that their subjects were using the Multiplicative Rule: the total wait people expect is one and a third times as long as they’ve waited so far. This is consistent with having a power-law distribution as a prior, where a wide range of scales is possible. Just hope you don’t end up on the Titanic of hold times. Over the past decade, approaches like these have enabled cognitive scientists to identify people’s prior distributions across a broad swath of domains, from vision to language.
然而,这里有一个关键的警告。如果我们缺乏良好的先验知识,我们的预测就不会准确。例如,在汤姆和乔希的研究中,有一个主题的预测系统性地偏离了贝叶斯规则:预测埃及法老的统治年限。(事实上,法老的统治遵循埃尔朗分布。)人们的日常经验不足以直观地感受这些数值的范围,因此他们的预测自然会出错。好的预测需要好的先验知识。
There’s a crucial caveat here, however. In cases where we don’t have good priors, our predictions aren’t good. In Tom and Josh’s study, for instance, there was one subject where people’s predictions systematically diverged from Bayes’s Rule: predicting the length of the reign of Egyptian pharaohs. (As it happens, pharaohs’ reigns follow an Erlang distribution.) People simply didn’t have enough everyday exposure to have an intuitive feel for the range of those values, so their predictions, of course, faltered. Good predictions require good priors.
这具有许多重要的意义。我们的判断背叛了我们的预期,而我们的预期又背叛了我们的经验。我们对未来的预测揭示了很多东西——关于我们生活的世界,以及我们自己的过去。
This has a number of important implications. Our judgments betray our expectations, and our expectations betray our experience. What we project about the future reveals a lot—about the world we live in, and about our own past.
我们的预测告诉我们关于自身的事情
What Our Predictions Tell Us About Ourselves
20世纪70年代初,沃尔特·米歇尔(Walter Mischel)进行了著名的“棉花糖测试”,试图理解延迟满足的能力是如何随着年龄增长而发展的。在斯坦福大学校园的一所幼儿园,研究人员对一组三岁、四岁和五岁的儿童进行了意志力测试。每个孩子都会得到一份美味的零食,比如一块棉花糖,并被告知进行实验的成年人即将离开房间一会儿。如果他们愿意,可以马上吃掉。但如果他们等到实验者回来,就能得到两份零食。
When Walter Mischel ran his famous “marshmallow test” in the early 1970s, he was trying to understand how the ability to delay gratification develops with age. At a nursery school on the Stanford campus, a series of three-, four-, and five-year-olds had their willpower tested. Each child would be shown a delicious treat, such as a marshmallow, and told that the adult running the experiment was about to leave the room for a while. If they wanted to, they could eat the treat right away. But if they waited until the experimenter came back, they would get two treats.
有些孩子忍不住,立刻就把零食吃了。还有些孩子坚持了足足十五分钟左右,直到实验员回来,才如约得到了两份零食。但最有趣的或许是那些介于两者之间的孩子——他们虽然等了一会儿,但最终还是屈服了,把零食吃了。
Unable to resist, some of the children ate the treat immediately. And some of them stuck it out for the full fifteen minutes or so until the experimenter returned, and got two treats as promised. But perhaps the most interesting group comprised the ones in between—the ones who managed to wait a little while, but then surrendered and ate the treat.
这些案例中,孩子们拼尽全力,勇敢地承受着痛苦,最终还是屈服了,失去了多余的棉花糖。这种现象被解读为一种非理性。既然要屈服,为什么不立刻屈服,免去那些折磨呢?但这完全取决于孩子们认为自己处于什么样的境地。正如宾夕法尼亚大学的乔·麦奎尔和乔·凯布尔所指出的,如果成年人回来所需的时间符合幂律分布——长时间缺席意味着未来还要等待更长时间——那么在某个时候止损就完全合情合理了。
These cases, where children struggled mightily and suffered valiantly, only to give in and lose the extra marshmallow anyway, have been interpreted as suggesting a kind of irrationality. If you’re going to cave, why not just cave immediately, and skip the torture? But it all depends on what kind of situation the children think they are in. As the University of Pennsylvania’s Joe McGuire and Joe Kable have pointed out, if the amount of time it takes for adults to come back is governed by a power-law distribution—with long absences suggesting even longer waits lie ahead—then cutting one’s losses at some point can make perfect sense.
换句话说,抵制诱惑的能力可能至少在一定程度上取决于预期而非意志力。如果你预测成年人往往会在短暂的等待后回来——类似于正态分布——你应该能够坚持下去。平均法则表明,在痛苦的等待之后,要做的就是坚持下去:实验者应该随时都会回来。但如果你不知道消失的时间尺度——符合幂律分布——那么这将是一场艰苦的战斗。乘法法则则表明,长时间的等待只是即将发生的事情的一小部分。
In other words, the ability to resist temptation may be, at least in part, a matter of expectations rather than willpower. If you predict that adults tend to come back after short delays—something like a normal distribution—you should be able to hold out. The Average Rule suggests that after a painful wait, the thing to do is hang in there: the experimenter should be returning any minute now. But if you have no idea of the timescale of the disappearance—consistent with a power-law distribution—then it’s an uphill battle. The Multiplicative Rule then suggests that a protracted wait is just a small fraction of what’s to come.
最初的棉花糖实验几十年后,沃尔特·米歇尔和他的同事们回过头来,观察了参与者的生活状况。令人惊讶的是,他们发现,那些等待两次棉花糖的孩子长大成人后,甚至比其他人更成功,甚至以SAT成绩等量化指标来衡量也是如此。如果棉花糖测试关乎意志力,那么这有力地证明了学习自控力对人生的影响。但如果这项测试关注的不是意志力,而是预期,那么它讲述的或许是一个截然不同、或许更令人心酸的故事。
Decades after the original marshmallow experiments, Walter Mischel and his colleagues went back and looked at how the participants were faring in life. Astonishingly, they found that children who had waited for two treats grew into young adults who were more successful than the others, even measured by quantitative metrics like their SAT scores. If the marshmallow test is about willpower, this is a powerful testament to the impact that learning self-control can have on one’s life. But if the test is less about will than about expectations, then this tells a different, perhaps more poignant story.
罗切斯特大学的一组研究人员最近探索了先前经历如何影响棉花糖测试中的行为。在提到棉花糖之前,实验中的孩子们就开始了一个艺术项目。实验者给了他们一些普通的艺术用品,并承诺很快会带着更好的回来。然而,孩子们并不知道,他们被分成了两组。一组的实验者很可靠,回来时也兑现了承诺,带回了更好的艺术用品。另一组则不可靠,回来时除了道歉什么也没带。
A team of researchers at the University of Rochester recently explored how prior experiences might affect behavior in the marshmallow test. Before marshmallows were even mentioned, the kids in the experiment embarked on an art project. The experimenter gave them some mediocre supplies, and promised to be back with better options soon. But, unbeknownst to them, the children were divided into two groups. In one group, the experimenter was reliable, and came back with the better art supplies as promised. In the other, she was unreliable, coming back with nothing but apologies.
艺术作品完成后,孩子们继续进行标准的棉花糖测试。在这里,那些已经知道实验者不可靠的孩子更有可能在实验者回来之前吃掉棉花糖,从而失去了获得第二块棉花糖的机会。
The art project completed, the children went on to the standard marshmallow test. And here, the children who had learned that the experimenter was unreliable were more likely to eat the marshmallow before she came back, losing the opportunity to earn a second treat.
棉花糖测试失败——以及晚年生活不太成功——可能并非因为缺乏意志力。这可能是因为人们认为成年人不可靠:他们不值得信赖,会突然消失一段时间。学习自控固然重要,但同样重要的是,在一个成年人始终陪伴且值得信赖的环境中成长。
Failing the marshmallow test—and being less successful in later life—may not be about lacking willpower. It could be a result of believing that adults are not dependable: that they can’t be trusted to keep their word, that they disappear for intervals of arbitrary length. Learning self-control is important, but it’s equally important to grow up in an environment where adults are consistently present and trustworthy.
机械复制时代的先验
Priors in the Age of Mechanical Reproduction
就好像有人会买几份早报来确认报纸上的内容是真实的一样。
As if someone were to buy several copies of the morning paper to assure himself that what it said was true.
—路德维希·维特根斯坦
—LUDWIG WITTGENSTEIN
他谨慎地阅读,因为那是他将要写的东西。他谨慎地学习,因为那是他将要知道的东西。
He is careful of what he reads, for that is what he will write. He is careful of what he learns, for that is what he will know.
—安妮·迪拉德
—ANNIE DILLARD
正如贝叶斯规则所示,做出正确预测的最佳方法是准确了解你所预测的事情。这就是为什么我们能够很好地预测人类寿命,却无法估算法老的统治时间。
The best way to make good predictions, as Bayes’s Rule shows us, is to be accurately informed about the things you’re predicting. That’s why we can do a good job of projecting human life spans, but perform poorly when asked to estimate the reigns of pharaohs.
成为一名优秀的贝叶斯学家意味着能够以正确的比例表征世界——拥有良好且经过适当校准的先验知识。总的来说,对于人类和其他动物来说,这很自然;通常来说,当某事令我们感到惊讶时,它就应该让我们感到惊讶;当它没有让我们感到惊讶时,它就不应该让我们感到惊讶。即使我们积累了一些客观上并不正确的偏见,它们通常仍然能够合理地反映我们所处世界的特定区域。例如,生活在沙漠气候中的人可能会高估世界上的沙量,而生活在极地的人可能会高估积雪量。两者都很好地适应了各自的生态位。
Being a good Bayesian means representing the world in the correct proportions—having good priors, appropriately calibrated. By and large, for humans and other animals this happens naturally; as a rule, when something surprises us, it ought to surprise us, and when it doesn’t, it ought not to. Even when we accumulate biases that aren’t objectively correct, they still usually do a reasonable job of reflecting the specific part of the world we live in. For instance, someone living in a desert climate might overestimate the amount of sand in the world, and someone living at the poles might overestimate the amount of snow. Both are well tuned to their own ecological niche.
然而,当一个物种拥有语言时,一切都开始崩塌。我们谈论的并非我们所经历的——我们主要谈论的是有趣的事情,而这些事情往往并不常见。从定义上来说,事件总是以其固有的频率被体验,但语言却并非如此。任何经历过蛇咬或雷击的人,都会在余生中不断复述这些奇特的故事。这些故事如此引人注目,以至于会被其他人拾起并复述。
Everything starts to break down, however, when a species gains language. What we talk about isn’t what we experience—we speak chiefly of interesting things, and those tend to be things that are uncommon. More or less by definition, events are always experienced at their proper frequencies, but this isn’t at all true of language. Anyone who has experienced a snake bite or a lightning strike will tend to retell those singular stories for the rest of their lives. And those stories will be so salient that they will be picked up and retold by others.
因此,在与他人沟通和保持对世界的准确先验之间存在着一种奇怪的矛盾。当人们谈论自己感兴趣的话题,并提供他们认为听众会感兴趣的故事时,这会扭曲我们经验的统计数据。这使得保持适当的先验分布变得困难。而且,随着印刷机、晚间新闻和社交媒体的发展——这些创新使得我们人类能够机械地传播语言——这一挑战也愈发严峻。
There’s a curious tension, then, between communicating with others and maintaining accurate priors about the world. When people talk about what interests them—and offer stories they think their listeners will find interesting—it skews the statistics of our experience. That makes it hard to maintain appropriate prior distributions. And the challenge has only increased with the development of the printing press, the nightly news, and social media—innovations that allow our species to spread language mechanically.
想想你见过多少次飞机坠毁或汽车坠毁。你很可能见过的次数大致相同——但很多汽车就在你身边的路上,而飞机可能在另一个大陆,通过互联网或电视传送给你。例如,在美国,自2000年以来,在商用飞机失事中丧生的总人数还不足以让卡内基音乐厅挤满一半。相比之下,同一时期,美国死于车祸的人数甚至超过了怀俄明州的总人口。
Consider how many times you’ve seen either a crashed plane or a crashed car. It’s entirely possible you’ve seen roughly as many of each—yet many of those cars were on the road next to you, whereas the planes were probably on another continent, transmitted to you via the Internet or television. In the United States, for instance, the total number of people who have lost their lives in commercial plane crashes since the year 2000 would not be enough to fill Carnegie Hall even half full. In contrast, the number of people in the United States killed in car accidents over that same time is greater than the entire population of Wyoming.
简而言之,媒体对事件的呈现方式与它们在世界范围内的发生频率并不匹配。正如社会学家巴里·格拉斯纳所指出的,20世纪90年代,美国的谋杀率下降了20%,但与此同时,美国新闻中枪支暴力事件的出现率却增加了600 %。
Simply put, the representation of events in the media does not track their frequency in the world. As sociologist Barry Glassner notes, the murder rate in the United States declined by 20% over the course of the 1990s, yet during that time period the presence of gun violence on American news increased by 600%.
如果你想成为一个优秀的直觉贝叶斯主义者——如果你想自然地做出正确的预测,而不必思考哪种预测规则合适——你需要保护你的先验知识。与直觉相反,这可能意味着关掉新闻。
If you want to be a good intuitive Bayesian—if you want to naturally make good predictions, without having to think about what kind of prediction rule is appropriate—you need to protect your priors. Counterintuitively, that might mean turning off the news.
*这里有一定的讽刺意味:当谈到时间时,假设我们的到来没有什么特别之处,最终会导致我们想象自己处于最中心。
*There’s a certain irony here: when it comes to time, assuming that there’s nothing special about our arrival does result in us imagining ourselves at the very center after all.
*这正是拉普拉斯定律最简单的形式:它假设 1% 或 10% 的彩票中奖概率与 50% 或 100% 的概率一样。( w +1) / ( n +2)公式似乎有些天真,因为它假设在购买一张输掉的强力球彩票后,你下次购买时有 1/3 的概率中奖——但这个结果忠实地反映了你在完全不知情的情况下参与抽奖的概率。
*This is precisely what Laplace’s Law does in its simplest form: it assumes that having 1% or 10% of the tickets be winners is just as likely as 50% or 100%. The (w+1)⁄(n+2) formula might seem naive in its suggestion that after buying a single losing Powerball ticket you have a 1/3 chance of winning on your next one—but that result faithfully reflects the odds in a raffle where you come in knowing nothing at all.
查尔斯·达尔文在犹豫是否应该向表妹埃玛·韦奇伍德求婚时,拿出纸笔,权衡了所有可能的后果。赞成结婚的,他列出了孩子、陪伴,以及“音乐和女性闲聊的魅力”。反对结婚的,他列举了“时间的极大浪费”、无法自由出行、探亲的负担、孩子带来的开销和焦虑、担心“我的妻子可能不喜欢伦敦”,以及买书的钱更少。在权衡两列之后,达尔文的胜负略有悬殊,于是在表格底部潦草地写下:“结婚——结婚——结婚(已证明)” (Quod erat demonstrandum),这个数学符号后来被达尔文本人用英语重新表述:“事实证明有必要结婚。”
When Charles Darwin was trying to decide whether he should propose to his cousin Emma Wedgwood, he got out a pencil and paper and weighed every possible consequence. In favor of marriage he listed children, companionship, and the “charms of music & female chit-chat.” Against marriage he listed the “terrible loss of time,” lack of freedom to go where he wished, the burden of visiting relatives, the expense and anxiety provoked by children, the concern that “perhaps my wife won’t like London,” and having less money to spend on books. Weighing one column against the other produced a narrow margin of victory, and at the bottom Darwin scrawled, “Marry—Marry—Marry Q.E.D.” Quod erat demonstrandum, the mathematical sign-off that Darwin himself then restated in English: “It being proved necessary to Marry.”
早在达尔文时代,利弊清单就已成为一种历史悠久的算法,并于一个世纪前得到了本杰明·富兰克林的认可。为了克服“困扰我们的不确定性”,富兰克林写道:
The pro-and-con list was already a time-honored algorithm by Darwin’s time, being endorsed by Benjamin Franklin a century before. To get over “the Uncertainty that perplexes us,” Franklin wrote,
我的方法是,用一条线将一张纸的一半分成两栏,一栏写赞成,一栏写反对。然后,我会用三四天的时间考虑,在不同的标题下写下我在不同时间想到的支持或反对该措施的不同动机的简短提示。当我把它们放在一个观点下时,我会努力估计它们各自的分量;如果我发现两边各一个看起来相等的动机,我会把它们都划掉:如果我发现一个赞成的理由等于两个反对的理由,我会划掉三个。如果我认为两个反对的理由等于三个赞成的理由,我会划掉五个;就这样继续下去,我终于找到了平衡点;如果经过一两天的进一步考虑,双方都没有出现新的重要内容,我就会据此做出决定。
my Way is, divide half a Sheet of Paper by a Line into two Columns, writing over the one Pro, and over the other Con. Then during three or four Days Consideration I put down under the different Heads short Hints of the different Motives that at different Times occur to me for or against the Measure. When I have thus got them all together in one View, I endeavour to estimate their respective Weights; and where I find two, one on each side, that seem equal, I strike them both out: If I find a Reason pro equal to some two Reasons con, I strike out the three. If I judge some two Reasons con equal to some three Reasons pro, I strike out the five; and thus proceeding I find at length where the Ballance lies; and if after a Day or two of farther Consideration nothing new that is of Importance occurs on either side, I come to a Determination accordingly.
富兰克林甚至认为这就像是一种计算,他说:“我发现这种方程式具有很大的优势,可以称之为道德代数或审慎代数。”
Franklin even thought about this as something like a computation, saying, “I have found great Advantage from this kind of Equation, in what may be called Moral or Prudential Algebra.”
达尔文的日记,1838 年 7 月。经剑桥大学图书馆许可转载。
Darwin’s journal, July 1838. Reprinted with permission of Cambridge University Library.
当我们思考时,很容易假设越多越好:你列出的利弊越多,你做出的决定就越好;你识别的相关因素越多,你对股票价格的预测就越准确;你花在报告上的时间越多,你写出的报告就越好。这无疑是富兰克林体系背后的前提。从这个意义上讲,达尔文对婚姻的“代数”方法,尽管明显有些古怪,却似乎异常理性,甚至可以说是值得称赞的理性。
When we think about thinking, it’s easy to assume that more is better: that you will make a better decision the more pros and cons you list, make a better prediction about the price of a stock the more relevant factors you identify, and write a better report the more time you spend working on it. This is certainly the premise behind Franklin’s system. In this sense, Darwin’s “algebraic” approach to matrimony, despite its obvious eccentricity, seems remarkably and maybe even laudably rational.
然而,如果富兰克林或达尔文生活在机器学习研究的时代——这门教导计算机根据经验做出正确判断的科学——他们就会看到道德代数的根基被彻底动摇。思考的难度以及需要考虑的因素数量,是统计学家和机器学习研究人员称之为“过度拟合”的一个棘手问题的核心。解决这个问题揭示了刻意少思考也是一种智慧。意识到过度拟合会改变我们对待市场、餐桌、健身房……以及圣坛的态度。
However, if Franklin or Darwin had lived into the era of machine-learning research—the science of teaching computers to make good judgments from experience—they’d have seen Moral Algebra shaken to its foundations. The question of how hard to think, and how many factors to consider, is at the heart of a knotty problem that statisticians and machine-learning researchers call “overfitting.” And dealing with that problem reveals that there’s a wisdom to deliberately thinking less. Being aware of overfitting changes how we should approach the market, the dining table, the gym … and the altar.
反对复杂性的案例
The Case Against Complexity
你能做的任何事我都能做得更好;我能做的任何事我都能做得比你更好。
Anything you can do I can do better; I can do anything better than you.
—安妮拿起你的枪
—ANNIE GET YOUR GUN
每个决定都是一种预测:关于你会有多喜欢某个尚未尝试的事物,关于某种趋势的发展方向,关于人迹罕至(或更人迹罕至)的道路可能会如何发展。至关重要的是,每个预测都涉及思考两件截然不同的事情:你知道什么,你不知道什么。也就是说,它试图构建一个理论,既能解释你迄今为止的经验,又能解释你所猜测的未来。当然,一个好的理论会兼顾两者。但事实上,每个预测都必须兼顾两者,这造成了某种不可避免的矛盾。
Every decision is a kind of prediction: about how much you’ll like something you haven’t tried yet, about where a certain trend is heading, about how the road less traveled (or more so) is likely to pan out. And every prediction, crucially, involves thinking about two distinct things: what you know and what you don’t. That is, it’s an attempt to formulate a theory that will account for the experiences you’ve had to date and say something about the future ones you’re guessing at. A good theory, of course, will do both. But the fact that every prediction must in effect pull double duty creates a certain unavoidable tension.
生活满意度是婚后时间的函数。
Life satisfaction as a function of time since marriage.
为了说明这种矛盾,我们来看看一组可能与达尔文相关的数据:最近在德国进行的一项研究,研究了人们婚后十年的生活满意度。图表上的每个点都取自这项研究本身;我们的工作是找出一条适合这些点并延伸到未来的直线公式,以便我们能够预测十年之后的生活。
As one illustration of this tension, let’s look at a data set that might have been relevant to Darwin: people’s life satisfaction over their first ten years of marriage, from a recent study conducted in Germany. Each point on that chart is taken from the study itself; our job is to figure out the formula for a line that would fit those points and extend into the future, allowing us to make predictions past the ten-year mark.
一种可能的公式是只使用一个因素来预测生活满意度:婚后时间。这样图表上就会出现一条直线。另一种可能性是使用两个因素:时间和时间的平方;得到的直线将呈现抛物线U形,从而能够捕捉时间与幸福感之间可能更复杂的关系。如果我们扩展公式,纳入更多因素(时间的立方等等),这条线就会出现越来越多的拐点,变得越来越“弯曲”,越来越灵活。等到我们得到一个包含九个因素的公式时,我们就能捕捉到非常复杂的关系了。
One possible formula would use just a single factor to predict life satisfaction: the time since marriage. This would create a straight line on the chart. Another possibility is to use two factors, time and time squared; the resulting line would have a parabolic U-shape, letting it capture a potentially more complex relationship between time and happiness. And if we expand the formula to include yet more factors (time cubed and so on), the line will acquire ever more inflection points, getting more and more “bendy” and flexible. By the time we get to a nine-factor formula, we can capture very complex relationships indeed.
从数学上讲,我们的双因素模型包含了单因素模型的所有信息,并且还有一个可以使用的术语。同样,九因素模型利用了双因素模型的所有信息,甚至可能包含更多信息。按照这个逻辑,九因素模型似乎总能给出最好的预测。
Mathematically speaking, our two-factor model incorporates all the information that goes into the one-factor model, and has another term it could use as well. Likewise, the nine-factor model leverages all of the information at the disposal of the two-factor model, plus potentially lots more. By this logic, it seems like the nine-factor model ought to always give us the best predictions.
事实证明,事情并没有那么简单。
As it turns out, things are not quite so simple.
使用具有不同数量因素的模型来预测生活满意度。
Predictions of life satisfaction using models with different numbers of factors.
将这些模型应用于数据的结果如上所示。单因素模型不出所料地遗漏了许多精确的数据点,尽管它捕捉到了基本趋势——蜜月期幸福过后的生活质量下降。然而,它的直线预测表明,这种下降趋势将永远持续下去,最终导致无尽的痛苦。这条轨迹听起来有些不对劲。双因素模型更接近于拟合调查数据,其曲线形状做出了不同的长期预测,表明生活满意度在最初的下降之后,会随着时间的推移逐渐趋于平稳。最后,九因素模型通过了图表上的每一个点;它基本上完美地拟合了研究中的所有数据。
The result of applying these models to the data is shown above. The one-factor model, unsurprisingly, misses a lot of the exact data points, though it captures the basic trend—a comedown after the honeymoon bliss. However, its straight-line prediction forecasts that this decrease will continue forever, ultimately resulting in infinite misery. Something about that trajectory doesn’t sound quite right. The two-factor model comes closer to fitting the survey data, and its curved shape makes a different long-term prediction, suggesting that after the initial decline life satisfaction more or less levels out over time. Finally, the nine-factor model passes through each and every point on the chart; it is essentially a perfect fit for all the data from the study.
从这个意义上讲,九因素公式似乎确实是我们最好的模型。但如果你看看它对研究未涵盖年份的预测,你可能会质疑它到底有多大用处:它预测了婚姻的痛苦,婚后几个月满意度的突然飙升,之后就像坐过山车一样跌宕起伏,以及十年后的急剧下降。相比之下,双因素模型预测的稳定状态与心理学家和经济学家对婚姻和幸福的看法最为一致。(顺便说一句,他们认为这仅仅反映了人们对婚姻生活的满意度回归常态——回归到人们对生活的基线水平——而不是对婚姻本身的不满。)
In that sense it seems like the nine-factor formula is indeed our best model. But if you look at the predictions it makes for the years not included in the study, you might wonder about just how useful it really is: it predicts misery at the altar, a giddily abrupt rise in satisfaction after several months of marriage, a bumpy roller-coaster ride thereafter, and a sheer drop after year ten. By contrast, the leveling off predicted by the two-factor model is the forecast most consistent with what psychologists and economists say about marriage and happiness. (They believe, incidentally, that it simply reflects a return to normalcy—to people’s baseline level of satisfaction with their lives—rather than any displeasure with marriage itself.)
教训是:的确,在模型中加入更多因素,从定义上来说,总是会使其更适合我们现有的数据。但更适合现有数据并不一定意味着预测结果更准确。
The lesson is this: it is indeed true that including more factors in a model will always, by definition, make it a better fit for the data we have already. But a better fit for the available data does not necessarily mean a better prediction.
向数据中添加少量随机“噪声”(模拟对不同组参与者重复调查的效果)会导致九因素模型产生剧烈波动,而相比之下,单因素和双因素模型的预测结果更加稳定和一致。
Adding small amounts of random “noise” to the data (simulating the effects of repeating the survey with a different group of participants) produces wild undulations in the nine-factor model, while the one- and two-factor models in comparison are much more stable and consistent in their predictions.
诚然,过于简单的模型(例如单因素公式的直线)可能无法捕捉到数据中的本质模式。如果事实看起来像一条曲线,那么任何直线都无法准确描述它。另一方面,过于复杂的模型(比如我们这里的九因素模型)会对我们偶然观察到的特定数据点过于敏感。结果,正是因为它针对特定数据集进行了如此精细的调整,它产生的解决方案差异很大。如果对不同的人重复这项研究,在同一基本模式上产生细微的变化,那么单因素和双因素模型将或多或少保持稳定,但九因素模型会在研究的不同实例之间发生剧烈波动。这就是统计学家所说的过度拟合。
Granted, a model that’s too simple—for instance, the straight line of the one-factor formula—can fail to capture the essential pattern in the data. If the truth looks like a curve, no straight line can ever get it right. On the other hand, a model that’s too complicated, such as our nine-factor model here, becomes oversensitive to the particular data points that we happened to observe. As a consequence, precisely because it is tuned so finely to that specific data set, the solutions it produces are highly variable. If the study were repeated with different people, producing slight variations on the same essential pattern, the one- and two-factor models would remain more or less steady—but the nine-factor model would gyrate wildly from one instance of the study to the next. This is what statisticians call overfitting.
因此,机器学习最深刻的真理之一是,实际上,使用更复杂的模型(考虑更多因素的模型)并不总是更好。问题不仅在于额外的因素可能会带来收益递减——虽然它们比简单的模型表现更好,但不足以证明增加复杂性是合理的。相反,它们可能会使我们的预测结果急剧恶化。
So one of the deepest truths of machine learning is that, in fact, it’s not always better to use a more complex model, one that takes a greater number of factors into account. And the issue is not just that the extra factors might offer diminishing returns—performing better than a simpler model, but not enough to justify the added complexity. Rather, they might make our predictions dramatically worse.
数据崇拜
The Idolatry of Data
如果我们拥有海量数据,这些数据取自一个极具代表性的样本,完全没有错误,并且能够准确反映我们想要评估的内容,那么使用最复杂的模型确实是最佳方法。但是,如果我们试图在任何一个因素不成立的情况下,让模型与数据完美拟合,就会面临过度拟合的风险。
If we had copious data, drawn from a perfectly representative sample, completely mistake-free, and representing exactly what we’re trying to evaluate, then using the most complex model available would indeed be the best approach. But if we try to perfectly fit our model to the data when any of these factors fails to hold, we risk overfitting.
换句话说,过度拟合在我们处理噪声或测量误差时总是存在危险——我们几乎总是如此。数据收集或报告的方式可能存在错误。有时,被研究的现象,例如人类的幸福感,甚至难以定义,更不用说衡量了。由于其灵活性,我们现有的最复杂的模型可以拟合数据中出现的任何模式,但这意味着即使这些模式只是噪声中的幻影和海市蜃楼,它们也能做到这一点。
In other words, overfitting poses a danger any time we’re dealing with noise or mismeasurement—and we almost always are. There can be errors in how the data were collected, or in how they were reported. Sometimes the phenomena being investigated, such as human happiness, are hard to even define, let alone measure. Thanks to their flexibility, the most complex models available to us can fit any patterns that appear in the data, but this means that they will also do so even when those patterns are mere phantoms and mirages in the noise.
纵观历史,宗教典籍一直告诫信徒切勿偶像崇拜:不要崇拜雕像、绘画、文物和其他有形的器物,而要崇拜这些器物所代表的无形神灵。例如,《十诫》第一条就告诫信徒不可跪拜“任何雕刻的偶像,或天上百物的形象”。《列王纪》中,一条奉上帝之命而造的铜蛇,取代了上帝本身,成为人们崇拜和焚香的对象。(上帝对此并不感到好笑。)从根本上说,过度拟合是一种数据偶像崇拜,是人们关注可测量数据而非重要数据的结果。
Throughout history, religious texts have warned their followers against idolatry: the worshipping of statues, paintings, relics, and other tangible artifacts in lieu of the intangible deities those artifacts represent. The First Commandment, for instance, warns against bowing down to “any graven image, or any likeness of any thing that is in heaven.” And in the Book of Kings, a bronze snake made at God’s orders becomes an object of worship and incense-burning, instead of God himself. (God is not amused.) Fundamentally, overfitting is a kind of idolatry of data, a consequence of focusing on what we’ve been able to measure rather than what matters.
我们掌握的数据和我们想要的预测之间的差距几乎无处不在。在做重大决定时,我们只能通过思考当前对我们重要的因素来猜测什么会让我们以后满意。(正如哈佛大学的丹尼尔·吉尔伯特所说,未来的自己常常“花大价钱去掉我们花大价钱纹的纹身”。)在做财务预测时,我们只能看过去与股票价格相关的因素,而看不到未来可能与股价相关的因素。即使在我们日常生活中的小事上也是如此:写一封电子邮件,我们会根据自己对文本的理解来预测收件人的理解。因此,与公共调查一样,我们生活中的数据也总是充满噪音,充其量只是我们真正关心的事情的替代指标。
This gap between the data we have and the predictions we want is virtually everywhere. When making a big decision, we can only guess at what will please us later by thinking about the factors important to us right now. (As Harvard’s Daniel Gilbert puts it, our future selves often “pay good money to remove the tattoos that we paid good money to get.”) When making a financial forecast, we can only look at what correlated with the price of a stock in the past, not what might in the future. Even in our small daily acts this pattern holds: writing an email, we use our own read-through of the text to predict that of the recipient. No less than in public surveys, the data in our own lives are thus also always noisy, at best a proxy metric for the things we really care about.
因此,考虑越来越多的因素并花费更多的精力来对它们进行建模可能会导致我们犯下优化错误的错误——向数据这条铜蛇祈祷,而不是向其背后更强大的力量祈祷。
As a consequence, considering more and more factors and expending more effort to model them can lead us into the error of optimizing for the wrong thing—offering prayers to the bronze snake of data rather than the larger force behind it.
处处过度拟合
Overfitting Everywhere
一旦你了解了过度拟合,你就会随处看到它。
Once you know about overfitting, you see it everywhere.
比如,过度拟合解释了我们味觉的讽刺之处。为什么我们觉得味道最好的食物却被普遍认为对健康有害?而从进化的角度来说,味蕾的全部功能就是阻止我们吃那些不健康的东西。
Overfitting, for instance, explains the irony of our palates. How can it be that the foods that taste best to us are broadly considered to be bad for our health, when the entire function of taste buds, evolutionarily speaking, is to prevent us from eating things that are bad?
答案是,味觉是我们身体健康的替代指标。脂肪、糖和盐都是重要的营养素,几十万年来,人们被含有这些营养素的食物所吸引,是维持饮食的合理指标。
The answer is that taste is our body’s proxy metric for health. Fat, sugar, and salt are important nutrients, and for a couple hundred thousand years, being drawn to foods containing them was a reasonable measure for a sustaining diet.
但如今,我们能够改变食物的种类,打破了这种关系。如今,我们可以在食物中添加超过健康标准的脂肪和糖,然后只吃这些食物,而不是像人类历史上那样,以植物、谷物和肉类为主要饮食结构。换句话说,我们的味觉会变得“过度适应”。我们越能巧妙地操控食物(我们的生活方式与祖先的差异越大),衡量味觉的标准就越不完美。因此,我们人类的自主性变成了一种诅咒,让我们即使不完全想要某种东西,也能危险地拥有我们想要的一切。
But being able to modify the foods available to us broke that relationship. We can now add fat and sugar to foods beyond amounts that are good for us, and then eat those foods exclusively rather than the mix of plants, grains, and meats that historically made up the human diet. In other words, we can overfit taste. And the more skillfully we can manipulate food (and the more our lifestyles diverge from those of our ancestors), the more imperfect a metric taste becomes. Our human agency thus turns into a curse, making us dangerously able to have exactly what we want even when we don’t quite want exactly the right thing.
注意:当你去健身房减掉糖分摄入带来的多余体重时,你也可能面临过度拟合的风险。某些可见的健康指标——例如低体脂和高肌肉量——很容易衡量,而且它们与降低患心脏病和其他疾病的风险相关。但它们也并非完美的替代指标。过度拟合信号——例如采用极端饮食来降低体脂,以及服用类固醇来增强肌肉——可能会让你看起来像个健康人,但这仅仅是表面现象而已。
Beware: when you go to the gym to work off the extra weight from all that sugar, you can also risk overfitting fitness. Certain visible signs of fitness—low body fat and high muscle mass, for example—are easy to measure, and they are related to, say, minimizing the risk of heart disease and other ailments. But they, too, are an imperfect proxy measure. Overfitting the signals—adopting an extreme diet to lower body fat and taking steroids to build muscle, perhaps—can make you the picture of good health, but only the picture.
过度拟合现象在体育运动中也时有出现。例如,汤姆从十几岁起就断断续续地练习击剑。击剑最初的目标是教会人们如何在决斗中自卫,因此得名“防御”。现代击剑中使用的武器与过去用于训练此类对抗的武器类似。(重剑尤其如此,不到五十年前,它仍在正式决斗中使用。)但电子计分设备(剑尖上的一个按钮,用于记录击中次数)的引入改变了这项运动的性质,一些在正式决斗中可能毫无用处的技巧,如今却成了比赛中的关键技能。现代击剑运动员使用灵活的剑刃,可以“轻弹”一下按钮,轻轻擦过对手,力度刚好足以击中并得分。因此,他们看起来更像是在挥舞细细的金属鞭子,而不是在切割或刺击。这项运动一如既往地令人兴奋,但随着运动员为了适应记分规则而过度调整战术,它在灌输现实世界的剑术技能方面变得不再那么有用。
Overfitting also shows up in sports. For instance, Tom has been a fencer, on and off, since he was a teenager. The original goal of fencing was to teach people how to defend themselves in a duel, hence the name: “defencing.” And the weapons used in modern fencing are similar to those that were used to train for such encounters. (This is particularly true of the épée, which was still used in formal duels less than fifty years ago.) But the introduction of electronic scoring equipment—a button on the tip of the blade that registers a hit—has changed the nature of the sport, and techniques that would serve you poorly in a serious duel have become critical skills in competition. Modern fencers use flexible blades that allow them to “flick” the button at their opponent, grazing just hard enough to register and score. As a result, they can look more like they’re cracking thin metal whips at each other than cutting or thrusting. It’s as exciting a sport as ever, but as athletes overfit their tactics to the quirks of scorekeeping, it becomes less useful in instilling the skills of real-world swordsmanship.
然而,或许没有哪个地方像商业世界那样,过度拟合如此强大且令人困扰。正如史蒂夫·乔布斯所说:“激励机制是有效的。所以你必须非常谨慎地考虑你激励人们做什么,因为各种激励机制会产生各种你无法预料的后果。” 初创企业孵化器 Y Combinator 总裁萨姆·奥特曼 (Sam Altman) 也赞同乔布斯的谨慎之言:“CEO 决定衡量什么,公司就会做什么,这千真万确。”
Perhaps nowhere, however, is overfitting as powerful and troublesome as in the world of business. “Incentive structures work,” as Steve Jobs put it. “So you have to be very careful of what you incent people to do, because various incentive structures create all sorts of consequences that you can’t anticipate.” Sam Altman, president of the startup incubator Y Combinator, echoes Jobs’s words of caution: “It really is true that the company will build whatever the CEO decides to measure.”
事实上,想出一些不会产生不良影响的激励措施或衡量标准极其困难。20世纪50年代,康奈尔大学管理学教授VF Ridgway列举了大量此类“绩效衡量的失调后果”。一家职业介绍公司根据员工进行的面试次数进行考核,这促使他们尽可能快地完成面试,而没有花太多时间真正帮助客户找到工作。一家联邦执法机构的调查人员每月都会被分配绩效配额,结果发现他们往往在月底挑选简单的案件,而不是最紧急的案件。一家工厂的主管们过于关注生产指标,导致他们忽视了维护和维修,为未来的灾难埋下了伏笔。这些问题不能简单地归咎于未能实现管理目标。恰恰相反,它们是对错误事物进行无情而巧妙的优化。
In fact, it’s incredibly difficult to come up with incentives or measurements that do not have some kind of perverse effect. In the 1950s, Cornell management professor V. F. Ridgway cataloged a host of such “Dysfunctional Consequences of Performance Measurements.” At a job-placement firm, staffers were evaluated on the number of interviews they conducted, which motivated them to run through the meetings as quickly as possible, without spending much time actually helping their clients find jobs. At a federal law enforcement agency, investigators given monthly performance quotas were found to pick easy cases at the end of the month rather than the most urgent ones. And at a factory, focusing on production metrics led supervisors to neglect maintenance and repairs, setting up future catastrophe. Such problems can’t simply be dismissed as a failure to achieve management goals. Rather, they are the opposite: the ruthless and clever optimization of the wrong thing.
21世纪向实时分析的转变只会使指标的危险性更加加剧。谷歌数字营销推广员阿维纳什·考希克(Avinash Kaushik)警告称,试图让网站用户看到尽可能多的广告,自然会演变成试图在网站上塞满广告:“当你按[每千次展示费用]付费时,你的动机就是想方设法在每个页面上展示尽可能多的广告,[并]确保访问者看到网站上尽可能多的页面……这种动机会将焦点从重要的实体——你的客户——转移到次要的实体——你的广告商身上。” 短期内,网站或许能赚到一些钱,但充斥着广告的文章、加载缓慢的多页幻灯片以及耸人听闻的点击诱饵标题,从长远来看会赶走读者。考希克的结论是:“朋友永远不会让朋友衡量页面浏览量。”
The twenty-first-century shift into real-time analytics has only made the danger of metrics more intense. Avinash Kaushik, digital marketing evangelist at Google, warns that trying to get website users to see as many ads as possible naturally devolves into trying to cram sites with ads: “When you are paid on a [cost per thousand impressions] basis the incentive is to figure out how to show the most possible ads on every page [and] ensure the visitor sees the most possible pages on the site.… That incentive removes a focus from the important entity, your customer, and places it on the secondary entity, your advertiser.” The website might gain a little more money in the short term, but ad-crammed articles, slow-loading multi-page slide shows, and sensationalist clickbait headlines will drive away readers in the long run. Kaushik’s conclusion: “Friends don’t let friends measure Page Views. Ever.”
在某些情况下,模型与现实世界之间的差异实际上关乎生死。例如,在军队和执法部门,重复的、死记硬背的训练被认为是灌输一线技能的关键手段。其目标是将某些动作和战术训练到完全自动化的程度。但当过度拟合悄然出现时,后果可能不堪设想。例如,有些警察在枪战中抽出时间将用过的弹壳放进口袋——这是射击场上的良好礼仪。正如前陆军游骑兵和西点军校心理学教授戴夫·格罗斯曼所写:“在许多真实的枪战中,硝烟散去后,警官们惊讶地发现口袋里有空弹壳,却完全不记得是怎么来的。有好几次,警察的尸体被发现时手里还拿着弹壳,他们正处于一个早已被灌输到他们脑海中的行政程序中。”同样,联邦调查局(FBI)也被迫改变训练计划,因为特工们被发现本能地开了两枪就收枪——这是训练中的标准节奏——无论他们的子弹是否击中目标,也无论威胁是否仍然存在。这类错误在执法部门和军队中被称为“训练伤疤”,它们反映出一个人的准备工作可能过度。在一个特别戏剧性的案例中,一名警官本能地从袭击者手中夺过枪,然后本能地把它交还——就像他在训练中一次又一次地对着教官那样。
In some cases, the difference between a model and the real world is literally a matter of life and death. In the military and in law enforcement, for example, repetitive, rote training is considered a key means for instilling line-of-fire skills. The goal is to drill certain motions and tactics to the point that they become totally automatic. But when overfitting creeps in, it can prove disastrous. There are stories of police officers who find themselves, for instance, taking time out during a gunfight to put their spent casings in their pockets—good etiquette on a firing range. As former Army Ranger and West Point psychology professor Dave Grossman writes, “After the smoke had settled in many real gunfights, officers were shocked to discover empty brass in their pockets with no memory of how it got there. On several occasions, dead cops were found with brass in their hands, dying in the middle of an administrative procedure that had been drilled into them.” Similarly, the FBI was forced to change its training after agents were found reflexively firing two shots and then holstering their weapon—a standard cadence in training—regardless of whether their shots had hit the target and whether there was still a threat. Mistakes like these are known in law enforcement and the military as “training scars,” and they reflect the fact that it’s possible to overfit one’s own preparation. In one particularly dramatic case, an officer instinctively grabbed the gun out of the hands of an assailant and then instinctively handed it right back—just as he had done time and time again with his trainers in practice.
检测过度拟合:交叉验证
Detecting Overfitting: Cross-Validation
由于过度拟合最初表现为一种与现有数据完美拟合的理论,因此它似乎难以察觉。我们又该如何区分一个真正优秀的模型和一个过度拟合的模型呢?在教育领域,我们如何区分一群在特定学科上表现优异的学生和一群仅仅被“应试教育”的学生呢?在商业世界中,我们如何区分真正的明星员工和那些仅仅为了公司的关键绩效指标(KPI)或老板的认知而精心设计过度拟合的员工呢?
Because overfitting presents itself initially as a theory that perfectly fits the available data, it may seem insidiously hard to detect. How can we expect to tell the difference between a genuinely good model and one that’s overfitting? In an educational setting, how can we distinguish between a class of students excelling at the subject matter and a class merely being “taught to the test”? In the business world, how can we tell a genuine star performer from an employee who has just cannily overfit their work to the company’s key performance indicators—or to the boss’s perception?
区分这些场景确实很有挑战性,但并非不可能。机器学习研究已经提出了几种检测过拟合的具体策略,其中最重要的一种就是所谓的交叉验证。
Teasing apart those scenarios is indeed challenging, but it is not impossible. Research in machine learning has yielded several concrete strategies for detecting overfitting, and one of the most important is what’s known as Cross-Validation.
简而言之,交叉验证不仅要评估模型对给定数据的拟合程度,还要评估其对未见数据的泛化程度。矛盾的是,这可能意味着使用更少的数据。在婚姻的例子中,我们可能会“保留”两个随机点,只将我们的模型与其余八个点拟合。然后,我们会取这两个测试点,并用它们来衡量我们的各种函数在给定的八个“训练”点之外的泛化能力。这两个保留点就像煤矿里的金丝雀:如果一个复杂的模型在八个训练点上成功,但在两个测试点上却严重失准,那么很有可能是过度拟合在起作用。
Simply put, Cross-Validation means assessing not only how well a model fits the data it’s given, but how well it generalizes to data it hasn’t seen. Paradoxically, this may involve using less data. In the marriage example, we might “hold back,” say, two points at random, and fit our models only to the other eight. We’d then take those two test points and use them to gauge how well our various functions generalize beyond the eight “training” points they’ve been given. The two held-back points function as canaries in the coal mine: if a complex model nails the eight training points but wildly misses the two test points, it’s a good bet that overfitting is at work.
除了保留一些可用的数据点外,考虑使用完全来自其他评估形式的数据来测试模型也是有益的。正如我们所见,使用替代指标(例如用口味代替营养,用破案数量代替研究人员的勤奋程度)也可能导致过度拟合。在这种情况下,我们需要将我们使用的主要绩效指标与其他可能的指标进行交叉验证。
Aside from withholding some of the available data points, it is also useful to consider testing the model with data derived from some other form of evaluation entirely. As we have seen, the use of proxy metrics—taste as a proxy for nutrition, number of cases solved as a proxy for investigator diligence—can also lead to overfitting. In these cases, we’ll need to cross-validate the primary performance measure we’re using against other possible measures.
例如,在学校里,标准化考试有很多好处,包括显著的规模经济效益:数千名学生可以低成本、快速地进行评分。然而,除了这类考试之外,学校还可以随机评估一小部分学生——比如每个班一个,或者一百个学生中选一个——采用不同的评估方法,例如论文或口试。(由于只有少数学生会接受这种测试,因此这种次要方法能否很好地推广并不是什么大问题。)标准化考试可以提供即时反馈——例如,你可以让学生每周参加一次简短的计算机考试,并几乎实时地记录全班的学习进度——而次要数据点可以用于交叉验证:确保学生真正掌握了标准化考试所要衡量的知识,而不仅仅是提高应试能力。如果一所学校的标准化分数上升,而其“非标准化”成绩却朝着相反的方向发展,那么管理者就会收到一个明确的警告信号,表明“应试教学”已经开始,学生的技能开始过度适应考试本身的机制。
In schools, for example, standardized tests offer a number of benefits, including a distinct economy of scale: they can be graded cheaply and rapidly by the thousands. Alongside such tests, however, schools could randomly assess some small fraction of the students—one per class, say, or one in a hundred—using a different evaluation method, perhaps something like an essay or an oral exam. (Since only a few students would be tested this way, having this secondary method scale well is not a big concern.) The standardized tests would provide immediate feedback—you could have students take a short computerized exam every week and chart the class’s progress almost in real time, for instance—while the secondary data points would serve to cross-validate: to make sure that the students were actually acquiring the knowledge that the standardized test is meant to measure, and not simply getting better at test-taking. If a school’s standardized scores rose while its “nonstandardized” performance moved in the opposite direction, administrators would have a clear warning sign that “teaching to the test” had set in, and the pupils’ skills were beginning to overfit the mechanics of the test itself.
交叉验证也为执法人员和军事人员提供了一个建议,帮助他们在不通过训练过程本身就养成习惯的情况下,培养良好的反应能力。正如论文和口试可以交叉验证标准化考试一样,偶尔进行一些不熟悉的“交叉训练”评估,也可以用来衡量反应时间和射击精度是否适用于不熟悉的任务。如果没有,那么这是一个强烈的信号,表明需要改变训练方案。虽然没有什么能真正让人为实战做好准备,但像这样的练习至少可以提前预警哪些地方可能已经形成了“训练伤疤”。
Cross-Validation also offers a suggestion for law enforcement and military personnel looking to instill good reflexes without hammering in habits from the training process itself. Just as essays and oral exams can cross-validate standardized tests, so occasional unfamiliar “cross-training” assessments might be used to measure whether reaction time and shooting accuracy are generalizing to unfamiliar tasks. If they aren’t, then that’s a strong signal to change the training regimen. While nothing may truly prepare one for actual combat, exercises like this may at least warn in advance where “training scars” are likely to have formed.
如何对抗过度拟合:惩罚复杂性
How to Combat Overfitting: Penalizing Complexity
如果你不能简单地解释它,那你就没有足够理解它。
If you can’t explain it simply, you don’t understand it well enough.
-匿名的
—ANONYMOUS
我们已经了解了过度拟合的一些表现形式,也研究了一些检测和测量过度拟合的方法。但我们究竟能做些什么来缓解它呢?
We’ve seen some of the ways that overfitting can rear its head, and we’ve looked at some of the methods to detect and measure it. But what can we actually do to alleviate it?
从统计学的角度来看,过度拟合是对我们所见实际数据过于敏感的一种表现。因此,解决方案很简单:我们必须在寻找良好拟合的愿望与所用模型的复杂性之间取得平衡。
From a statistics viewpoint, overfitting is a symptom of being too sensitive to the actual data we’ve seen. The solution, then, is straightforward: we must balance our desire to find a good fit against the complexity of the models we use to do so.
在众多相互竞争的模型中进行选择的一种方法是奥卡姆剃刀原理,该原理认为,在其他条件相同的情况下,最简单的假设可能就是正确的假设。当然,事情很少会完全相同,因此在数学背景下应用奥卡姆剃刀原理并不是显而易见的。20 世纪 60 年代,俄罗斯数学家安德烈·季霍诺夫在应对这一挑战时提出了一个答案:在计算中引入一个附加项,惩罚更复杂的解。如果我们引入复杂性惩罚,那么更复杂的模型不仅需要做得更好,而且需要做得更好来解释数据,以证明其更高的复杂性是合理的。计算机科学家将这一原理(使用约束来惩罚模型的复杂性)称为正则化。
One way to choose among several competing models is the Occam’s razor principle, which suggests that, all things being equal, the simplest possible hypothesis is probably the correct one. Of course, things are rarely completely equal, so it’s not immediately obvious how to apply something like Occam’s razor in a mathematical context. Grappling with this challenge in the 1960s, Russian mathematician Andrey Tikhonov proposed one answer: introduce an additional term to your calculations that penalizes more complex solutions. If we introduce a complexity penalty, then more complex models need to do not merely a better job but a significantly better job of explaining the data to justify their greater complexity. Computer scientists refer to this principle—using constraints that penalize models for their complexity—as Regularization.
那么,这些复杂性惩罚究竟是什么样的呢?生物统计学家罗伯特·蒂布希拉尼 (Robert Tibshirani) 于 1996 年发现了一种名为Lasso 的算法,该算法将模型中不同因子的总权重作为惩罚项。*通过对因子的权重施加向下的压力,Lasso 算法会将尽可能多的因子完全降为零。只有对结果影响较大的因子才会保留在方程中——这样一来,例如,可以将一个过度拟合的九因子模型,转化为一个更简单、更稳健的公式,只包含几个最关键的因子。
So what do these complexity penalties look like? One algorithm, discovered in 1996 by biostatistician Robert Tibshirani, is called the Lasso and uses as its penalty the total weight of the different factors in the model.* By putting this downward pressure on the weights of the factors, the Lasso drives as many of them as possible completely to zero. Only the factors that have a big impact on the results remain in the equation—thus potentially transforming, say, an overfitted nine-factor model into a simpler, more robust formula with just a couple of the most critical factors.
像套索这样的技术如今在机器学习中无处不在,但同样的原理——复杂性惩罚——也出现在自然界中。由于时间、记忆、能量和注意力的限制,生物体几乎会自动地趋向于简单。例如,新陈代谢的负担会抑制生物体的复杂性,为过于复杂的机制引入热量惩罚。人类大脑消耗了人类每日总热量摄入的五分之一,这一事实证明了我们的智力能力为我们带来的进化优势:大脑的贡献肯定足以支付那笔巨额的燃料费用。另一方面,我们也可以推断,从进化的角度来说,一个复杂得多的大脑可能并没有提供足够的回报。我们的智力已经达到了我们需要的水平,但并没有过度地高。
Techniques like the Lasso are now ubiquitous in machine learning, but the same kind of principle—a penalty for complexity—also appears in nature. Living organisms get a certain push toward simplicity almost automatically, thanks to the constraints of time, memory, energy, and attention. The burden of metabolism, for instance, acts as a brake on the complexity of organisms, introducing a caloric penalty for overly elaborate machinery. The fact that the human brain burns about a fifth of humans’ total daily caloric intake is a testament to the evolutionary advantages that our intellectual abilities provide us with: the brain’s contributions must somehow more than pay for that sizable fuel bill. On the other hand, we can also infer that a substantially more complex brain probably didn’t provide sufficient dividends, evolutionarily speaking. We’re as brainy as we have needed to be, but not extravagantly more so.
人们认为,同样的过程在神经层面也发挥着作用。在计算机科学领域,基于大脑的软件模型被称为“人工神经网络”,可以学习任意复杂的功能——它们甚至比我们上面的九因素模型更加灵活——但正是因为这种灵活性,它们也出了名地容易过度拟合。实际的生物神经网络可以在一定程度上规避这个问题,因为它们需要在性能和维护成本之间进行权衡。例如,神经科学家认为,大脑会试图最小化在任何特定时刻激活的神经元数量——这与套索算法一样,对复杂性施加了向下的压力。
The same kind of process is also believed to play a role at the neural level. In computer science, software models based on the brain, known as “artificial neural networks,” can learn arbitrarily complex functions—they’re even more flexible than our nine-factor model above—but precisely because of this very flexibility they are notoriously vulnerable to overfitting. Actual, biological neural networks sidestep some of this problem because they need to trade off their performance against the costs of maintaining it. Neuroscientists have suggested, for instance, that brains try to minimize the number of neurons that are firing at any given moment—implementing the same kind of downward pressure on complexity as the Lasso.
语言构成了另一种天然的“套索”:复杂性会因为冗长的演讲和对听众注意力持续时间的消耗而受到惩罚。商业计划会被压缩成电梯游说;人生建议只有足够简洁、引人入胜才能成为谚语般的智慧。任何需要记住的东西都必须通过记忆这道与生俱来的“套索”。
Language forms yet another natural Lasso: complexity is punished by the labor of speaking at greater length and the taxing of our listener’s attention span. Business plans get compressed to an elevator pitch; life advice becomes proverbial wisdom only if it is sufficiently concise and catchy. And anything that needs to be remembered has to pass through the inherent Lasso of memory.
启发式方法的优势
The Upside of Heuristics
经济学家哈里·马科维茨因发展了现代投资组合理论而荣获1990年诺贝尔经济学奖:他开创性的“均值-方差投资组合优化”理论,展示了投资者如何在给定风险水平下,对各种基金和资产进行最优配置,从而实现收益最大化。因此,当他需要投资自己的退休储蓄时,马科维茨似乎本应是最适合这项任务的人选。他最终做出了怎样的决定?
The economist Harry Markowitz won the 1990 Nobel Prize in Economics for developing modern portfolio theory: his groundbreaking “mean-variance portfolio optimization” showed how an investor could make an optimal allocation among various funds and assets to maximize returns at a given level of risk. So when it came time to invest his own retirement savings, it seems like Markowitz should have been the one person perfectly equipped for the job. What did he decide to do?
我应该计算一下各个资产类别的历史协方差,并画出一个有效前沿。但我却在脑中想象,如果股市大涨而我没有入市,或者股市大跌而我完全入市,我的悲痛会如何。我的目的是尽量减少未来的遗憾。所以我把我的资金五五分成了债券和股票。
I should have computed the historical covariances of the asset classes and drawn an efficient frontier. Instead, I visualized my grief if the stock market went way up and I wasn’t in it—or if it went way down and I was completely in it. My intention was to minimize my future regret. So I split my contributions fifty-fifty between bonds and equities.
他究竟为什么要这么做?这位诺贝尔奖得主及其投资策略的故事,可以作为人类非理性的一个例子:面对现实生活的复杂性,他放弃了理性模型,转而遵循简单的启发式方法。但正是因为现实生活的复杂性,简单的启发式方法实际上可能才是理性的解决方案。
Why in the world would he do that? The story of the Nobel Prize winner and his investment strategy could be presented as an example of human irrationality: faced with the complexity of real life, he abandoned the rational model and followed a simple heuristic. But it’s precisely because of the complexity of real life that a simple heuristic might in fact be the rational solution.
事实证明,在投资组合管理方面,除非你对自己掌握的市场信息非常有信心,否则完全忽略这些信息可能反而更好。应用马科维茨的最优投资组合配置方案需要对不同投资的统计特性进行精准的估计。这些估计中的错误可能会导致截然不同的资产配置,从而可能增加风险。相比之下,将资金均匀地分配到股票和债券上,则完全不受你观察到的数据的影响。这种策略甚至不会尝试去适应这些投资类型的历史表现——因此它不可能出现过度拟合的情况。
When it comes to portfolio management, it turns out that unless you’re highly confident in the information you have about the markets, you may actually be better off ignoring that information altogether. Applying Markowitz’s optimal portfolio allocation scheme requires having good estimates of the statistical properties of different investments. An error in those estimates can result in very different asset allocations, potentially increasing risk. In contrast, splitting your money evenly across stocks and bonds is not affected at all by what data you’ve observed. This strategy doesn’t even try to fit itself to the historical performance of those investment types—so there’s no way it can overfit.
当然,仅仅采用五五开的分割策略未必是复杂度的最佳平衡点,但这样做还是有其道理的。如果你恰好知道一组投资组合的预期均值和预期方差,那么就使用均值-方差投资组合优化——最优算法之所以是最优的,是有原因的。但是,当正确估计所有变量的概率很低,而模型赋予这些不可靠变量的权重很高时,决策过程就应该拉响警报:是时候进行正则化了。
Of course, just using a fifty-fifty split is not necessarily the complexity sweet spot, but there’s something to be said for it. If you happen to know the expected mean and expected variance of a set of investments, then use mean-variance portfolio optimization—the optimal algorithm is optimal for a reason. But when the odds of estimating them all correctly are low, and the weight that the model puts on those untrustworthy quantities is high, then an alarm should be going off in the decision-making process: it’s time to regularize.
受马科维茨退休储蓄等案例的启发,心理学家格尔德·吉格伦泽(Gerd Gigerenzer)和亨利·布莱顿(Henry Brighton)认为,人们在现实世界中使用的决策捷径,在很多情况下正是促成正确决策的思维方式。他们写道:“与普遍认为处理减少会降低准确性的观点相反,启发式研究表明,更少的信息、计算和时间实际上可以提高准确性。” 倾向于更简单答案(包含更少的因素或更少的计算)的启发式方法,恰恰体现了“少即是多”的效应。
Inspired by examples like Markowitz’s retirement savings, psychologists Gerd Gigerenzer and Henry Brighton have argued that the decision-making shortcuts people use in the real world are in many cases exactly the kind of thinking that makes for good decisions. “In contrast to the widely held view that less processing reduces accuracy,” they write, “the study of heuristics shows that less information, computation, and time can in fact improve accuracy.” A heuristic that favors simpler answers—with fewer factors, or less computation—offers precisely these “less is more” effects.
然而,对模型的最终复杂度施加惩罚并非缓解过拟合的唯一方法。你还可以通过控制模型适应输入数据的速度来使其趋于简单。这使得对过拟合的研究成为我们历史——无论是作为一个社会还是作为一个物种——的启发性指南。
Imposing penalties on the ultimate complexity of a model is not the only way to alleviate overfitting, however. You can also nudge a model toward simplicity by controlling the speed with which you allow it to adapt to incoming data. This makes the study of overfitting an illuminating guide to our history—both as a society and as a species.
历史的重量
The Weight of History
活着的老鼠吃过的每种食物都不一定能杀死它。
Every food a living rat has eaten has, necessarily, not killed it.
—SAMUEL REVUSKY 和 ERWIN BEDARF,“疾病与先前摄入新食物的关系”
—SAMUEL REVUSKY AND ERWIN BEDARF, “ASSOCIATION OF ILLNESS WITH PRIOR INGESTION OF NOVEL FOODS”
从20世纪90年代中期到2013年,美国豆奶市场规模增长了四倍多。但到了2013年底,根据新闻头条报道,它似乎已成为过去,远远落后于杏仁奶。正如食品饮料研究员拉里·芬克尔在接受《彭博商业周刊》采访时所说:“坚果如今很流行。大豆听起来更像是老式的健康食品。” 以推广豆奶而闻名(顾名思义)的Silk公司在2013年末报告称,仅在上一季度,其杏仁奶产品销量就增长了50%以上。与此同时,在其他饮料新闻中,领先的椰子水品牌Vita Coco在2014年报告称,其销售额自2011年以来翻了一番,自2004年以来更是增长了惊人的三百倍。正如《纽约时报》所言,“椰子水似乎从默默无闻变成了不可或缺的商品,丝毫没有间断地融入到我们熟悉的领域。” 与此同时,羽衣甘蓝市场仅在2013年就增长了40%。前一年,羽衣甘蓝的最大买家是必胜客,他们把羽衣甘蓝放在沙拉吧里——作为装饰。
The soy milk market in the United States more than quadrupled from the mid-1990s to 2013. But by the end of 2013, according to news headlines, it already seemed to be a thing of the past, a distant second place to almond milk. As food and beverage researcher Larry Finkel told Bloomberg Businessweek: “Nuts are trendy now. Soy sounds more like old-fashioned health food.” The Silk company, famous for popularizing soy milk (as the name implies), reported in late 2013 that its almond milk products had grown by more than 50% in the previous quarter alone. Meanwhile, in other beverage news, the leading coconut water brand, Vita Coco, reported in 2014 that its sales had doubled since 2011—and had increased an astounding three-hundred-fold since 2004. As the New York Times put it, “coconut water seems to have jumped from invisible to unavoidable without a pause in the realm of the vaguely familiar.” Meanwhile, the kale market grew by 40% in 2013 alone. The biggest purchaser of kale the year before had been Pizza Hut, which put it in their salad bars—as decoration.
令人费解的是,人类生活中一些最基本的领域,例如我们应该吃什么,似乎最容易被昙花一现的时尚所左右。这些时尚之所以能够席卷全球,部分原因在于我们的文化瞬息万变。如今,信息在社会中的流通速度比以往任何时候都快,而全球供应链使得消费者能够迅速改变他们的购买习惯(而市场营销又鼓励他们这样做)。如果某项研究表明八角茴香有益于健康,那么它可能会在一周内席卷博客圈,一周后登上电视,六个月内几乎每家超市都会出现,专门的八角茴香食谱很快就会面世。这种惊人的速度既是福也是祸。
Some of the most fundamental domains of human life, such as the question of what we should put in our bodies, seem curiously to be the ones most dominated by short-lived fads. Part of what enables these fads to take the world by storm is how quickly our culture can change. Information now flows through society faster than ever before, while global supply chains enable consumers to rapidly change their buying habits en masse (and marketing encourages them to do so). If some particular study happens to suggest a health benefit from, say, star anise, it can be all over the blogosphere within the week, on television the week after that, and in seemingly every supermarket in six months, with dedicated star anise cookbooks soon rolling off the presses. This breathtaking speed is both a blessing and a curse.
相反,如果我们观察包括人类在内的生物体的进化方式,就会发现一个有趣的现象:变化是缓慢发生的。这意味着现代生物体的特性不仅由其当前环境塑造,也由其历史塑造。例如,我们神经系统奇特的交叉排列(身体左侧由大脑右侧控制,反之亦然)反映了脊椎动物的进化史。这种被称为“交叉”的现象被认为出现在进化过程中的某个时刻,当时早期脊椎动物的身体相对于头部旋转了 180 度;龙虾和蚯蚓等无脊椎动物的神经索位于动物的“腹部”,而脊椎动物的神经索则沿着脊柱走行。
In contrast, if we look at the way organisms—including humans—evolve, we notice something intriguing: change happens slowly. This means that the properties of modern-day organisms are shaped not only by their present environments, but also by their history. For example, the oddly cross-wired arrangement of our nervous system (the left side of our body controlled by the right side of our brain and vice versa) reflects the evolutionary history of vertebrates. This phenomenon, called “decussation,” is theorized to have arisen at a point in evolution when early vertebrates’ bodies twisted 180 degrees with respect to their heads; whereas the nerve cords of invertebrates such as lobsters and earthworms run on the “belly” side of the animal, vertebrates have their nerve cords along the spine instead.
人耳是另一个例子。从功能角度来看,人耳是一个将声波转换成电信号的系统,通过三块骨头(锤骨、砧骨和镫骨)进行放大。这套放大系统令人印象深刻,但其运作方式的具体细节却与历史限制息息相关。事实证明,爬行动物的耳朵里只有一块骨头,但下颌骨中却有哺乳动物所没有的额外骨头。这些下颌骨显然在哺乳动物的耳朵里被重新利用了。因此,我们耳朵解剖学的确切形态和结构至少在反映我们正被解决的听觉问题的同时,也反映了我们的进化史。
The human ear offers another example. Viewed from a functional perspective, it is a system for translating sound waves into electrical signals by way of amplification via three bones: the malleus, incus, and stapes. This amplification system is impressive—but the specifics of how it works have a lot to do with historical constraints. Reptiles, it turns out, have just a single bone in their ear, but additional bones in the jaw that mammals lack. Those jawbones were apparently repurposed in the mammalian ear. So the exact form and configuration of our ear anatomy reflects our evolutionary history at least as much as it does the auditory problem being solved.
过度拟合的概念让我们看到了这种进化包袱中存在的优点。尽管交叉的神经纤维和重新利用的颌骨可能看起来像是次优的安排,但我们并不一定希望进化完全优化生物体以适应其环境利基的每一次变化——或者,至少我们应该认识到,这样做会使它对进一步的环境变化极为敏感。另一方面,必须利用现有材料,这施加了一种有用的限制。它使得诱导生物体结构发生剧烈变化变得更加困难,也更难过度拟合。作为一个物种,受制于过去会让我们无法完美地适应我们已知的现在,但却有助于我们保持稳健,以应对我们未知的未来。
The concept of overfitting gives us a way of seeing the virtue in such evolutionary baggage. Though crossed-over nerve fibers and repurposed jawbones may seem like suboptimal arrangements, we don’t necessarily want evolution to fully optimize an organism to every shift in its environmental niche—or, at least, we should recognize that doing so would make it extremely sensitive to further environmental changes. Having to make use of existing materials, on the other hand, imposes a kind of useful restraint. It makes it harder to induce drastic changes in the structure of organisms, harder to overfit. As a species, being constrained by the past makes us less perfectly adjusted to the present we know but helps keep us robust for the future we don’t.
类似的洞见或许能帮助我们抵御人类社会瞬息万变的潮流。就文化而言,传统扮演着进化的制约因素。适度的保守主义,某种程度上偏向历史的偏见,可以缓冲我们免受潮流兴衰循环的影响。当然,这并不意味着我们应该忽视最新的数据。当然,我们应该追随潮流——但不必非得跟着潮流走。
A similar insight might help us resist the quick-moving fads of human society. When it comes to culture, tradition plays the role of the evolutionary constraints. A bit of conservatism, a certain bias in favor of history, can buffer us against the boom-and-bust cycle of fads. That doesn’t mean we ought to ignore the latest data either, of course. Jump toward the bandwagon, by all means—but not necessarily on it.
在机器学习中,缓慢推进的优势最具体地体现在一种名为“提前停止”的正则化技术中。在本章开头分析德国婚姻调查数据时,我们直接考察了拟合度最高的单因素、双因素和九因素模型。然而,在很多情况下,调整参数以找到给定数据的最佳拟合度本身就是一个过程。如果我们提前停止这个过程,不让模型变得过于复杂,会发生什么?同样,乍一看可能显得漫不经心或不够彻底,但实际上却是一项重要的策略。
In machine learning, the advantages of moving slowly emerge most concretely in a regularization technique known as Early Stopping. When we looked at the German marriage survey data at the beginning of the chapter, we went straight to examining the best-fitted one-, two-, and nine-factor models. In many situations, however, tuning the parameters to find the best possible fit for given data is a process in and of itself. What happens if we stop that process early and simply don’t allow a model the time to become too complex? Again, what might seem at first blush like being halfhearted or unthorough emerges, instead, as an important strategy in its own right.
例如,许多预测算法首先寻找最重要的单个因素,而不是直接跳转到多因素模型。只有找到第一个因素后,它们才会寻找下一个最重要的因素添加到模型中,然后再寻找下一个,依此类推。因此,只需在过度拟合出现之前,在短时间内停止该过程,就可以防止模型变得过于复杂。一种相关的预测计算方法是一次考虑一个数据点,在添加更多数据点之前,对模型进行调整以考虑每个新点;在这种情况下,模型的复杂性也会逐渐增加,因此在短时间内停止该过程可以帮助防止过度拟合。
Many prediction algorithms, for instance, start out by searching for the single most important factor rather than jumping to a multi-factor model. Only after finding that first factor do they look for the next most important factor to add to the model, then the next, and so on. Their models can therefore be kept from becoming overly complex simply by stopping the process short, before overfitting has had a chance to creep in. A related approach to calculating predictions considers one data point at a time, with the model tweaked to account for each new point before more points are added; there, too, the complexity of the model increases gradually, so stopping the process short can help keep it from overfitting.
这种设定——时间越多,复杂性也就越大——是许多人类活动的特征。给自己更多时间做决定并不一定意味着你会做出更好的决定。但它确实意味着你最终会考虑更多因素、更多假设、更多利弊,从而面临过度拟合的风险。
This kind of setup—where more time means more complexity—characterizes a lot of human endeavors. Giving yourself more time to decide about something does not necessarily mean that you’ll make a better decision. But it does guarantee that you’ll end up considering more factors, more hypotheticals, more pros and cons, and thus risk overfitting.
汤姆当教授时就有过类似的经历。第一个学期,他上第一堂课,投入了大量时间完善讲课——每一节课都要准备十几个小时。第二个学期,他上另一堂课,投入的时间就没那么多了,担心会搞砸。但奇怪的是:学生们喜欢第二节课。事实上,他们比第一节课更喜欢。结果发现,这些额外的时间都用来敲定那些只会让学生感到困惑的细节,结果在下次上课时就被删掉了。汤姆最终意识到,根本问题在于他一直用自己的品味和判断来代替学生的品味和判断。这个替代指标作为近似值效果还不错,但不值得过度拟合——这也解释了为什么花费额外的时间煞费苦心地“完善”所有幻灯片反而适得其反。
Tom had exactly this experience when he became a professor. His first semester, teaching his first class ever, he spent a huge amount of time perfecting his lectures—more than ten hours of preparation for every hour of class. His second semester, teaching a different class, he wasn’t able to put in as much time, and worried that it would be a disaster. But a strange thing happened: the students liked the second class. In fact, they liked it more than the first one. Those extra hours, it turned out, had been spent nailing down nitty-gritty details that only confused the students, and wound up getting cut from the lectures the next time Tom taught the class. The underlying issue, Tom eventually realized, was that he’d been using his own taste and judgment as a kind of proxy metric for his students’. This proxy metric worked reasonably well as an approximation, but it wasn’t worth overfitting—which explained why spending extra hours painstakingly “perfecting” all the slides had been counterproductive.
正则化在各种机器学习任务中的有效性表明,我们可以通过刻意思考和少做事来做出更好的决策。如果我们首先想到的因素很可能是最重要的因素,那么超过一定程度后,对问题进行更多思考不仅会浪费时间和精力,还会导致我们得到更糟糕的解决方案。提前停止为反对推理的理性论证提供了基础,即思考者反对思考的论证。但要将其转化为切实可行的建议,还需要回答一个问题:我们应该何时停止思考?
The effectiveness of regularization in all kinds of machine-learning tasks suggests that we can make better decisions by deliberately thinking and doing less. If the factors we come up with first are likely to be the most important ones, then beyond a certain point thinking more about a problem is not only going to be a waste of time and effort—it will lead us to worse solutions. Early Stopping provides the foundation for a reasoned argument against reasoning, the thinking person’s case against thought. But turning this into practical advice requires answering one more question: when should we stop thinking?
何时少想
When to Think Less
与所有涉及过拟合的问题一样,何时停止取决于你能测量的数据和真正重要的数据之间的差距。如果你掌握了所有事实,它们没有任何错误和不确定性,并且你可以直接评估对你来说重要的任何因素,那么就不要过早停止。仔细思考:复杂性和投入的努力是合适的。
As with all issues involving overfitting, how early to stop depends on the gap between what you can measure and what really matters. If you have all the facts, they’re free of all error and uncertainty, and you can directly assess whatever is important to you, then don’t stop early. Think long and hard: the complexity and effort are appropriate.
但情况几乎从来都不是这样的。如果你面临很大的不确定性,而数据又有限,那么务必尽早停止。如果你不清楚你的工作将如何被评估,以及由谁来评估,那么花费额外的时间去完善它,使其符合你自己(或任何人)对完美标准的个人猜测,就是不值得的。不确定性越大,你能衡量的和真正重要的之间的差距就越大,你就越应该警惕过度拟合——也就是说,你越应该追求简单,也越应该尽早停止。
But that’s almost never the case. If you have high uncertainty and limited data, then do stop early by all means. If you don’t have a clear read on how your work will be evaluated, and by whom, then it’s not worth the extra time to make it perfect with respect to your own (or anyone else’s) idiosyncratic guess at what perfection might be. The greater the uncertainty, the bigger the gap between what you can measure and what matters, the more you should watch out for overfitting—that is, the more you should prefer simplicity, and the earlier you should stop.
当你真正陷入迷茫时,最好的计划往往是最简单的。当我们的预期不确定,数据嘈杂时,最好的办法是用粗笔画,用粗线条思考。有时,这的确是字面意义上的粗笔画。正如企业家 Jason Fried 和 David Heinemeier Hansson 所解释的那样,他们需要集思广益的时间越长,他们使用的笔就越粗——这是一种巧妙的通过粗细线条来简化的方式:
When you’re truly in the dark, the best-laid plans will be the simplest. When our expectations are uncertain and the data are noisy, the best bet is to paint with a broad brush, to think in broad strokes. Sometimes literally. As entrepreneurs Jason Fried and David Heinemeier Hansson explain, the further ahead they need to brainstorm, the thicker the pen they use—a clever form of simplification by stroke size:
当我们开始设计某个东西时,我们会用一支又大又粗的 Sharpie 马克笔来勾勒想法,而不是用圆珠笔。为什么?因为笔尖太细,分辨率太高。它们会引导你去担心一些你暂时不该担心的事情,比如如何完善阴影,或者该用点线还是虚线。最终,你会把注意力集中在那些本该失焦的地方。
When we start designing something, we sketch out ideas with a big, thick Sharpie marker, instead of a ball-point pen. Why? Pen points are too fine. They’re too high-resolution. They encourage you to worry about things that you shouldn’t worry about yet, like perfecting the shading or whether to use a dotted or dashed line. You end up focusing on things that should still be out of focus.
用记号笔根本没法深入下去。你只能画形状、线条和方框。这很好。一开始你只需要考虑整体情况就行了。
A Sharpie makes it impossible to drill down that deep. You can only draw shapes, lines, and boxes. That’s good. The big picture is all you should be worrying about in the beginning.
正如麦吉尔大学的亨利·明茨伯格所说:“如果我们从无法衡量重要事物的前提出发,并以此为基础,会发生什么?那么,我们将不得不使用一种非常可怕的东西来代替测量:它被称为判断。”
As McGill’s Henry Mintzberg puts it, “What would happen if we started from the premise that we can’t measure what matters and go from there? Then instead of measurement we’d have to use something very scary: it’s called judgment.”
提前停止的结果是,有时候,问题并不在于在理性和直觉之间做出选择。直觉或许才是理性的解决方案。决策越复杂、不稳定、不确定,理性的方法就越明显。
The upshot of Early Stopping is that sometimes it’s not a matter of choosing between being rational and going with our first instinct. Going with our first instinct can be the rational solution. The more complex, unstable, and uncertain the decision, the more rational an approach that is.
回到达尔文,他求婚的抉择,或许仅仅基于他最初列举的几个利弊就能解决,而后续的利弊只会增加他为求婚所耗费的时间和焦虑,却未必有助于最终的解决(而且很可能反而会阻碍最终的解决)。让他下定决心的似乎是“像一只中性蜜蜂一样,工作、工作,最终却一事无成,这实在令人难以忍受。” 孩子和陪伴——他首先提到的几点——正是最终让他决定结婚的因素。而他的购书预算却让他分心。
To return to Darwin, his problem of deciding whether to propose could probably have been resolved based on just the first few pros and cons he identified, with the subsequent ones adding to the time and anxiety expended on the decision without necessarily aiding its resolution (and in all likelihood impeding it). What seemed to make up his mind was the thought that “it is intolerable to think of spending one’s whole life like a neuter bee, working, working, & nothing after all.” Children and companionship—the very first points he mentioned—were precisely those that ultimately swayed him in favor of marriage. His book budget was a distraction.
然而,在我们过度批评达尔文,将他描绘成一个根深蒂固的过度思考者之前,值得我们重新审视一下他日记中的这一页。看到这页的摹本,我们能发现一些有趣的东西。达尔文可不是富兰克林,他花了好几天时间思考各种问题。尽管他非常认真地对待这个改变人生的选择,但达尔文在笔记写到日记页底部时才下定了决心。他正在将日记调整到页面的正则化状态。这让人想起“提前停止”和“套索”:任何没有写进日记页的东西都不能构成最终决定。
Before we get too critical of Darwin, however, painting him as an inveterate overthinker, it’s worth taking a second look at this page from his diary. Seeing it in facsimile shows something fascinating. Darwin was no Franklin, adding assorted considerations for days. Despite the seriousness with which he approached this life-changing choice, Darwin made up his mind exactly when his notes reached the bottom of the diary sheet. He was regularizing to the page. This is reminiscent of both Early Stopping and the Lasso: anything that doesn’t make the page doesn’t make the decision.
达尔文下定决心结婚后,立即开始琢磨时机。“什么时候?早或晚,”他又在另一份利弊清单上写道,从幸福感到花费,从“尴尬”到他一直以来想乘坐热气球旅行和/或去威尔士的愿望,他都考虑了一番。但到了最后,他决定“算了,听天由命吧”——结果,几个月后,他向艾玛·韦奇伍德求婚,开启了一段美满的伴侣关系和幸福的家庭生活。
His mind made up to marry, Darwin immediately went on to overthink the timing. “When? Soon or Late,” he wrote above another list of pros and cons, considering everything from happiness to expenses to “awkwardness” to his long-standing desire to travel in a hot air balloon and/or to Wales. But by the end of the page he resolved to “Never mind, trust to chance”—and the result, within several months’ time, was a proposal to Emma Wedgwood, the start of a fulfilling partnership and a happy family life.
*对于数学爱好者来说,这是变量系数绝对值的总和。
*For the mathematically inclined, that’s the sum of the absolute values of the variables’ coefficients.
2010年,梅根·贝洛斯白天在普林斯顿大学攻读化学工程博士学位,晚上则筹划婚礼。她的研究重点是找到将氨基酸在蛋白质链中的最佳位置,从而产生具有特定特性的分子。(“如果最大化两种蛋白质的结合能,就能成功设计出某种生物功能的肽类抑制剂,从而真正抑制疾病的进展。”)在婚礼方面,她却被座位问题困扰。
In 2010 Meghan Bellows was working on her PhD in chemical engineering at Princeton by day and planning her wedding by night. Her research revolved around finding the right places to put amino acids in a protein chain to yield a molecule with particular characteristics. (“If you maximize the binding energy of two proteins then you can successfully design a peptidic inhibitor of some biological function so you can actually inhibit a disease’s progress.”) On the nuptial front, she was stuck on the problem of seating.
有九位大学好友,贝洛斯苦恼着还要把谁挤进这么一个小型聚会,才能凑成十人桌。更糟糕的是,她数了一下,竟然有十一位近亲。谁会被从受人尊敬的父母席上赶走?她该怎么向他们解释?还有,像她儿时的邻居、保姆,或者她父母的同事,那些在婚礼上根本不认识任何人的人呢?
There was a group of nine college friends, and Bellows agonized over who else to throw into the midst of such a mini-reunion to make a table of ten. Even worse, she’d counted up eleven close relatives. Who would get the boot from the honored parents’ table, and how could she explain it to them? And what about folks like her childhood neighbors and babysitter, or her parents’ work colleagues, who didn’t really know anyone at the wedding at all?
这个问题看起来和她在实验室研究的蛋白质问题一样难。然后她突然灵光一闪。这就是她在实验室研究的问题。一天晚上,她盯着座位表,“我意识到,我的博士论文中的氨基酸和蛋白质,与我婚礼上坐在桌边的人数,简直是一一对应的。”贝洛斯叫来未婚夫拿来一张纸,开始在纸上写写算式。氨基酸变成了“客人”,结合能变成了“关系”,分子之间所谓的“最近邻相互作用”变成了——嗯——“最近邻相互作用”。她可以用自己研究的算法来解决自己的婚礼问题。
The problem seemed every bit as hard as the protein problem she was working on at the lab. Then it hit her. It was the problem she was working on at the lab. One evening, as she stared at her seating charts, “I realized that there was literally a one-to-one correlation between the amino acids and proteins in my PhD thesis and people sitting at tables at my wedding.” Bellows called out to her fiancé for a piece of paper and began scribbling equations. Amino acids became guests, binding energies became relationships, and the molecules’ so-called nearest-neighbor interactions became—well—nearest-neighbor interactions. She could use the algorithms from her research to solve her own wedding.
Bellows 想出了一个用数字定义所有宾客之间关系强度的方法。如果一对宾客互不相识,则得 0 分;如果彼此相识,则得 1 分;如果他们是情侣,则得 50 分。(新娘的姐姐可以给所有想和她坐在一起的人打 10 分,这是一项特殊特权。)Bellows 随后设定了一些限制条件:餐桌的最大容量,以及每桌所需的最低分数,这样就不会出现任何一张餐桌变成挤满陌生人的尴尬“杂牌”的情况。她还明确了程序的目标:最大化宾客与同桌宾客之间的关系分数。
Bellows worked out a way to numerically define the strength of the relationships among all the guests. If a particular pair of people didn’t know one another they got a 0, if they did they got a 1, and if they were a couple they got a 50. (The sister of the bride got to give a score of 10 to all the people she wanted to sit with, as a special prerogative.) Bellows then specified a few constraints: the maximum table capacity, and a minimum score necessary for each table, so that no one table became the awkward “miscellaneous” group full of strangers. She also codified the program’s goal: to maximize the relationship scores between the guests and their tablemates.
婚礼上共有107位宾客,11张桌子,每张桌子可容纳10人。这意味着大约有11107种可能的座位安排:这是一个112位的数字,超过2000亿亿古戈尔,这个数字甚至比可观测宇宙中原子的数量(仅为80位)还要小。贝洛斯在周六晚上将作业提交到实验室的电脑上,让它不停地运转。周一早上她来上班时,电脑还在运行;她让电脑输出迄今为止找到的最佳任务,并将其重新放到蛋白质设计上。
There were 107 people at the wedding and 11 tables, which could accommodate ten people each. This means there were about 11107 possible seating plans: that’s a 112-digit number, more than 200 billion googols, a figure that dwarfs the (merely 80-digit) number of atoms in the observable universe. Bellows submitted the job to her lab computer on Saturday evening and let it churn. When she came in on Monday morning, it was still running; she had it spit out the best assignment it had found so far and put it back onto protein design.
即使拥有高性能的实验室计算机集群和整整36小时的处理时间,该程序也无法评估超过一小部分的潜在座位安排。真正的最优方案,也就是能够获得最高分的方案,很可能从未在它的排列组合中出现过。尽管如此,贝洛斯对计算机的结果感到满意。“它识别出了我们忽略的关系,”她说,并提出了一些令人愉悦、非同寻常的可能性,这些可能性是人类规划者从未考虑过的。例如,它建议将她的父母从家庭餐桌上移除,安排到他们多年未见的老朋友那里。它最终提出的安排得到了各方的一致认可——尽管新娘的母亲忍不住做了一些手动调整。
Even with a high-powered lab computer cluster and a full thirty-six hours of processing time, there was no way for the program to evaluate more than a tiny fraction of the potential seating arrangements. The odds are that the truly optimal solution, the one that would have earned the very highest score, never came up in its permutations. Still, Bellows was pleased with the computer’s results. “It identified relationships that we were forgetting about,” she says, offering delightful, unconventional possibilities that the human planners hadn’t even considered. For instance, it proposed removing her parents from the family table, putting them instead with old friends they hadn’t seen for years. Its final recommendation was an arrangement that all parties agreed was a hit—although the mother of the bride couldn’t resist making just a few manual tweaks.
普林斯顿大学实验室的全部计算能力都无法找到完美的座位安排,这或许令人惊讶。在我们迄今为止讨论的大多数领域中,简单的算法可以保证获得最优解。但正如计算机科学家在过去几十年中发现的那样,无论我们的计算机运行速度有多快,或者我们编写的程序多么巧妙,都存在着一整类问题,根本无法找到完美的解决方案。事实上,没有人比计算机科学家更了解这一点:面对看似无法克服的挑战,你既不应该永远苦苦挣扎,也不应该放弃,而应该——正如我们将看到的——尝试第三种完全不同的方法。
The fact that all the computing power of a lab at Princeton couldn’t find the perfect seating plan might seem surprising. In most of the domains we’ve discussed so far, straightforward algorithms could guarantee optimal solutions. But as computer scientists have discovered over the past few decades, there are entire classes of problems where a perfect solution is essentially unreachable, no matter how fast we make our computers or how cleverly we program them. In fact, no one understands as well as a computer scientist that in the face of a seemingly unmanageable challenge, you should neither toil forever nor give up, but—as we’ll see—try a third thing entirely.
优化的困难
The Difficulty of Optimization
在领导美国度过内战、起草《解放奴隶宣言》或发表葛底斯堡演说之前,亚伯拉罕·林肯曾在伊利诺伊州斯普林菲尔德担任“草原律师”,每年两次前往第八巡回法院,一干就是十六年。担任巡回律师意味着要进行真正的巡回审判——在十四个不同的县的城镇之间奔波审理案件,在数周内骑行数百英里。规划这些巡回审判自然带来了一个挑战:如何在尽可能少的里程内访问所有必要的城镇,并且不重复访问任何城镇。
Before leading the country through the American Civil War, before drafting the Emancipation Proclamation or delivering the Gettysburg Address, Abraham Lincoln worked as a “prairie lawyer” in Springfield, Illinois, traveling the Eighth Judicial Circuit twice a year for sixteen years. Being a circuit lawyer meant literally making a circuit—moving through towns in fourteen different counties to try cases, riding hundreds of miles over many weeks. Planning these circuits raised a natural challenge: how to visit all the necessary towns while covering as few miles as possible and without going to any town twice.
这是数学家和计算机科学家所称的“约束优化”问题的一个例子:如何在给定特定规则和记分指标的情况下,找到一组变量的单一最佳排列。事实上,它是所有优化问题中最著名的一个。如果它是在19世纪被研究的,它可能会永远被称为“草原律师问题”;如果它是在21世纪首次出现,它可能会被戏称为“送货无人机问题”。但与秘书问题一样,它出现于20世纪中期,而那个时期,它的经典名称“旅行商问题”无疑与那个时代有关。
This is an instance of what’s known to mathematicians and computer scientists as a “constrained optimization” problem: how to find the single best arrangement of a set of variables, given particular rules and a scorekeeping measure. In fact, it’s the most famous optimization problem of them all. If it had been studied in the nineteenth century it might have become forever known as “the prairie lawyer problem,” and if it had first come up in the twenty-first century it might have been nicknamed “the delivery drone problem.” But like the secretary problem, it emerged in the mid-twentieth century, a period unmistakably evoked by its canonical name: “the traveling salesman problem.”
路线规划问题直到 20 世纪 30 年代才引起数学界的关注,但随后便引起了广泛关注。数学家卡尔·门格尔 (Karl Menger) 在 1930 年提出了“邮政信使问题”,并指出没有比依次尝试所有可能性更简单的解决方案。哈斯勒·惠特尼 (Hassler Whitney) 在 1934 年普林斯顿大学的一次演讲中提出了这个问题,这个问题牢牢地印在了数学家梅里尔·弗勒德 (Merrill Flood) 的脑海中(您可能还记得第一章的内容,他也是秘书问题的第一个解法的提出者)。20 世纪 40 年代,弗勒德搬到加利福尼亚后,又将这个问题传播给了兰德研究所的同事,这个问题的标志性名称首次出现在数学家朱莉娅·罗宾逊 (Julia Robinson) 1949 年的一篇论文中。随着这个问题席卷数学界,它变得越来越臭名昭著。当时许多最伟大的思想家都对此痴迷不已,但似乎没有人能够取得真正的进展。
The problem of route planning didn’t get the attention of the mathematics community until the 1930s, but then it did so with a vengeance. Mathematician Karl Menger spoke of “the postal messenger problem” in 1930, noting that no easier solution was known than simply trying out every possibility in turn. Hassler Whitney posed the problem in a 1934 talk at Princeton, where it lodged firmly in the brain of fellow mathematician Merrill Flood (who, you might recall from chapter 1, is also credited with circulating the first solution to the secretary problem). When Flood moved to California in the 1940s he spread it in turn to his colleagues at the RAND Institute, and the problem’s iconic name first appeared in print in a 1949 paper by mathematician Julia Robinson. As the problem swept through mathematical circles, it grew in notoriety. Many of the greatest minds of the time obsessed over it, and no one seemed able to make real headway.
在旅行商问题中,问题不在于计算机(或数学家)能否找到最短路线:理论上,人们可以简单地列出所有可能性,并逐一测量。问题在于,随着城镇数量的增长,连接这些城镇的可能路线列表会呈爆炸式增长。路线只是城镇的排序,因此,用蛮力尝试所有城镇需要耗费可怕的O ( n !)“阶乘时间”——这在计算上相当于将一副牌抛向空中,直到它们恰好按顺序落地,从而对牌进行排序。
In the traveling salesman problem, the question isn’t whether a computer (or a mathematician) could find the shortest route: theoretically, one can simply crank out a list of all the possibilities and measure each one. Rather, the issue is that as the number of towns grows, the list of possible routes connecting them explodes. A route is just an ordering of the towns, so trying them all by brute force is the dreaded O(n!) “factorial time”—the computational equivalent of sorting a deck of cards by throwing them in the air until they happen to land in order.
问题是:还有希望做得更好吗?
The question is: is there any hope of doing better?
数十年的努力并未能解决旅行商问题。例如,弗勒德在1956年写道,当时距离他首次遇到这个问题已经过去了二十多年:“看来,要成功解决这个问题,可能需要一种与目前使用的方法截然不同的方法。事实上,很可能没有通用的方法来解决这个问题,而且不可能性结果也可能很有价值。” 又过了十年,人们的情绪更加低落。杰克·埃德蒙兹写道:“我猜想,对于旅行商问题,没有好的算法。”
Decades of work did little to tame the traveling salesman problem. Flood, for instance, wrote in 1956, more than twenty years after first encountering it: “It seems very likely that quite a different approach from any yet used may be required for successful treatment of the problem. In fact, there may well be no general method for treating the problem and impossibility results would also be valuable.” Another decade later, the mood was only more grim. “I conjecture,” wrote Jack Edmonds, “that there is no good algorithm for the traveling salesman problem.”
这些话将被证明具有预言性。
These words would prove prophetic.
定义难度
Defining Difficulty
20 世纪 60 年代中期,美国国家标准与技术研究院的 Edmonds 与 IBM 的 Alan Cobham 共同制定了一个工作定义,用以定义一个问题是否可解。他们提出了如今被称为“科巴姆-埃德蒙兹理论”的论点:如果一个算法的运行时间在所谓的“多项式时间”内——即O(n²)、O(n³ ),或者实际上n的任意次方——那么它就应该被认为是“高效的”。反过来,如果我们知道如何使用高效的算法来解决一个问题,我们就会认为它“可处理”。另一方面,如果我们不知道如何在多项式时间内解决的问题,则被认为是“棘手的”。除了最小规模之外,棘手的问题对于计算机来说,无论其多么强大,都无法解决。*
In the mid-1960s, Edmonds, at the National Institute of Standards and Technology, along with Alan Cobham of IBM, developed a working definition for what makes a problem feasible to solve or not. They asserted what’s now known as the Cobham–Edmonds thesis: an algorithm should be considered “efficient” if it runs in what’s called “polynomial time”—that is, O(n2), O(n3), or in fact n to the power of any number at all. A problem, in turn, is considered “tractable” if we know how to solve it using an efficient algorithm. A problem we don’t know how to solve in polynomial time, on the other hand, is considered “intractable.” And at anything but the smallest scales, intractable problems are beyond the reach of solution by computers, no matter how powerful.*
这可以说是计算机科学的核心洞见。问题的难度是可以量化的。而有些问题就是……很难。
This amounts to what is arguably the central insight of computer science. It’s possible to quantify the difficulty of a problem. And some problems are just … hard.
那么,旅行商问题又将何去何从呢?奇怪的是,我们至今仍未完全确定。1972 年,伯克利大学的理查德·卡普 (Richard Karp) 证明,旅行商问题与一类颇具争议的边缘问题相关,这些问题尚未被最终证明是否能够有效解决。但迄今为止,尚未找到任何此类问题的有效解决方案——这使得它们实际上难以解决——而且大多数计算机科学家认为也找不到任何解决方案。因此,弗勒德在 20 世纪 50 年代设想的旅行商问题的“不可能结果”很可能就是其最终命运。此外,许多其他优化问题——其影响范围从政治战略到公共卫生再到消防安全——也同样难以解决。
Where does this leave the traveling salesman problem? Curiously enough, we are still not quite sure. In 1972, Berkeley’s Richard Karp demonstrated that the traveling salesman problem is linked to a controversially borderline class of problems that have not yet been definitively proven to be either efficiently solvable or not. But so far there have been no efficient solutions found for any of those problems—making them effectively intractable—and most computer scientists believe that there aren’t any to be found. So the “impossibility result” for the traveling salesman problem that Flood imagined in the 1950s is likely to be its ultimate fate. What’s more, many other optimization problems—with implications for everything from political strategy to public health to fire safety—are similarly intractable.
但对于那些正在努力解决此类问题的计算机科学家来说,这个结论并非故事的结束。相反,它更像是一个战斗的号角。一旦认定一个问题难以解决,你就不能轻易放弃。正如调度专家Jan Karel Lenstra所说:“当问题变得棘手时,并不意味着你可以忘掉它,而意味着它只是处于不同的状态。它是一个强大的敌人,但你仍然必须与之抗争。” 而这正是该领域发现的宝贵经验,值得我们所有人学习的地方:如何最好地解决那些无法获得最佳答案的问题。如何放松身心。
But for the computer scientists who wrestle with such problems, this verdict isn’t the end of the story. Instead, it’s more like a call to arms. Having determined a problem to be intractable, you can’t just throw up your hands. As scheduling expert Jan Karel Lenstra told us, “When the problem is hard, it doesn’t mean that you can forget about it, it means that it’s just in a different status. It’s a serious enemy, but you still have to fight it.” And this is where the field figured out something invaluable, something we can all learn from: how to best approach problems whose optimal answers are out of reach. How to relax.
放松一下
Just Relax
完美是优秀的敌人。
The perfect is the enemy of the good.
—伏尔泰
—VOLTAIRE
当有人告诉你要放松时,很可能是因为你太紧张了——把事情看得太重了。当计算机科学家面临艰巨的挑战时,他们的思维也会转向放松,比如他们会四处传播《放松方法导论》或《离散放松技术》之类的书籍。但他们放松的不是自己,而是问题。
When somebody tells you to relax, it’s probably because you’re uptight—making a bigger deal of things than you should. When computer scientists are up against a formidable challenge, their minds also turn to relaxation, as they pass around books like An Introduction to Relaxation Methods or Discrete Relaxation Techniques. But they don’t relax themselves; they relax the problem.
计算机科学中最简单的松弛形式之一被称为约束松弛。在这种技术中,研究人员会移除问题的一些约束,并着手解决他们希望得到的问题。然后,在取得一定进展后,他们会尝试重新添加约束。也就是说,他们先让问题暂时变得更容易处理,然后再将其重新回归现实。
One of the simplest forms of relaxation in computer science is known as Constraint Relaxation. In this technique, researchers remove some of the problem’s constraints and set about solving the problem they wish they had. Then, after they’ve made a certain amount of headway, they try to add the constraints back in. That is, they make the problem temporarily easier to handle before bringing it back to reality.
例如,你可以放宽旅行商问题的约束,让推销员多次访问同一个城镇,并允许他免费原路返回。在这些更宽松的规则下找到最短路线,就得到了所谓的“最小生成树”。(如果你愿意,也可以将最小生成树视为连接每个城镇和至少一个其他城镇所需的最少道路里程。林肯司法巡回法院的最短旅行商路线和最小生成树如下所示。)事实证明,解决这个更宽松的问题对计算机来说几乎不需要任何时间。虽然最小生成树不一定能直接得到实际问题的解,但它仍然非常有用。首先,生成树及其免费的回溯功能永远不会比真正的解决方案更长,而真正的解决方案必须遵循所有规则。因此,我们可以将放宽的问题(幻想)用作现实的下限。如果我们计算出一组特定城镇的生成树距离为100英里,我们可以肯定旅行商距离不会小于100英里。如果我们找到一条110英里的路线,我们可以肯定它最多比最佳解决方案长10%。这样,即使不知道真正的答案是什么,我们也能了解距离有多近。
For instance, you can relax the traveling salesman problem by letting the salesman visit the same town more than once, and letting him retrace his steps for free. Finding the shortest route under these looser rules produces what’s called the “minimum spanning tree.” (If you prefer, you can also think of the minimum spanning tree as the fewest miles of road needed to connect every town to at least one other town. The shortest traveling salesman route and the minimum spanning tree for Lincoln’s judicial circuit are shown below.) As it turns out, solving this looser problem takes a computer essentially no time at all. And while the minimum spanning tree doesn’t necessarily lead straight to the solution of the real problem, it is quite useful all the same. For one thing, the spanning tree, with its free backtracking, will never be any longer than the real solution, which has to follow all the rules. Therefore, we can use the relaxed problem—the fantasy—as a lower bound on the reality. If we calculate that the spanning tree distance for a particular set of towns is 100 miles, we can be sure the traveling salesman distance will be no less than that. And if we find, say, a 110-mile route, we can be certain it is at most 10% longer than the best solution. Thus we can get a grasp of how close we are to the real answer even without knowing what it is.
图 8.1 林肯 1855 年司法巡回的最短旅行商路线(上)和最小生成树(下)。
Figure 8.1 The shortest traveling salesman route (top) and minimum spanning tree (bottom) for Lincoln’s 1855 judicial circuit.
更妙的是,在旅行商问题中,最小生成树实际上是寻找真正解决方案的最佳起点之一。借助此类方法,即使是最大规模的旅行商问题之一——寻找一条通往地球上每个城镇的最短路线——也能在与(未知的)最优解的误差不超过 0.05% 的范围内得到解决。
Even better, in the traveling salesman problem it turns out that the minimum spanning tree is actually one of the best starting points from which to begin a search for the real solution. Approaches like these have allowed even one of the largest traveling salesman problems imaginable—finding the shortest route that visits every single town on Earth—to be solved to within less than 0.05% of the (unknown) optimal solution.
虽然我们大多数人没有遇到过正式的算法版本的“约束放松”,但它的基本思想对于几乎所有对人生问题抱有远大梦想的人来说都很熟悉。如果你不害怕,你会做什么?这句话你可能在指导顾问的办公室里看到过,也可能在励志研讨会上听到过。如果你不会失败,你会做什么?同样,在考虑职业或事业问题时,我们也会问这样的问题:如果你中了彩票,你会做什么?或者换个角度,如果所有工作的薪水都一样,你会做什么?这些思维练习背后的想法正是“约束放松”:化难为易,在理想化的世界中取得进展,并将其移植回现实世界。如果你无法解决眼前的问题,那就解决一个更简单的版本——然后看看这个解决方案是否能为你提供一个起点,或者在解决完整问题时提供一盏明灯。也许可以。
Though most of us haven’t encountered the formal algorithmic version of Constraint Relaxation, its basic message is familiar to almost anyone who’s dreamed big about life questions. What would you do if you weren’t afraid? reads a mantra you might have seen in a guidance counselor’s office or heard at a motivational seminar. What would you do if you could not fail? Similarly, when considering questions of profession or career, we ask questions like What would you do if you won the lottery? or, taking a different tack, What would you do if all jobs paid the same? The idea behind such thought exercises is exactly that of Constraint Relaxation: to make the intractable tractable, to make progress in an idealized world that can be ported back to the real one. If you can’t solve the problem in front of you, solve an easier version of it—and then see if that solution offers you a starting point, or a beacon, in the full-blown problem. Maybe it does.
放松并不能保证提供一条通往完美答案的捷径。但计算机科学可以量化放松在时间和解决方案质量之间带来的权衡。在很多情况下,这种权衡是显而易见的——例如,在千万亿分之一的时间内,就能得到至少是完美解决方案一半的答案。这其中蕴含的信息简单却深刻:如果我们愿意接受足够接近的解,那么即使是一些最棘手的问题,也能用正确的技巧来解决。
What relaxation cannot do is offer you a guaranteed shortcut to the perfect answer. But computer science can also quantify the tradeoff that relaxation offers between time and solution quality. In many cases, the ratio is dramatic, a no-brainer—for instance, an answer at least half as good as the perfect solution in a quadrillionth of the time. The message is simple but profound: if we’re willing to accept solutions that are close enough, then even some of the hairiest problems around can be tamed with the right techniques.
暂时移除约束,例如在最小生成树和“如果你中了彩票会怎样?”的例子中,是算法松弛最直接的形式。但还有另外两种更微妙的松弛类型在优化研究中反复出现。它们已被证明在解决该领域一些最重要的棘手问题方面发挥了重要作用,并对从城市规划、疾病控制到体育竞技培养等各个领域都产生了直接的现实影响。
Temporarily removing constraints, as in the minimum spanning tree and the “what if you won the lottery?” examples, is the most straightforward form of algorithmic relaxation. But there are also two other, subtler types of relaxation that repeatedly show up in optimization research. They have proven instrumental in solving some of the field’s most important intractable problems, with direct real-world implications for everything from city planning and disease control to the cultivation of athletic rivalries.
无数的灰色:持续放松
Uncountably Many Shades of Gray: Continuous Relaxation
旅行商问题,就像梅根·贝洛斯寻找最佳座位安排的问题一样,是一种特殊的优化问题,被称为“离散优化”——也就是说,它的解之间没有平滑的连续统。销售员要么去这个城镇,要么去那个城镇;你要么坐在5号桌,要么坐在6号桌。两者之间没有灰色地带。
The traveling salesman problem, like Meghan Bellows’s search for the best seating arrangement, is a particular kind of optimization problem known as “discrete optimization”—that is, there’s no smooth continuum among its solutions. The salesman goes either to this town or to that one; you’re either at table five or at table six. There are no shades of gray in between.
类似的离散优化问题在我们身边随处可见。例如,在城市中,规划人员会尝试将消防车放置在固定的时间内(例如五分钟)到达每栋房屋的位置。从数学上讲,每辆消防车都会“覆盖”从其位置五分钟内可以到达的所有房屋。挑战在于找到覆盖所有房屋的最小位置集。“整个[消防和应急]行业刚刚采用了这种覆盖模型,这很棒,”威斯康星大学麦迪逊分校的劳拉·阿尔伯特·麦克莱说道。“这是一个很好的、清晰的模型,我们可以建模。”但是,由于消防车要么存在于某个位置,要么不存在,因此计算这个最小集合涉及离散优化。正如麦克莱所指出的,“当你无法只做一半时,很多问题就会变得难以计算。”
Such discrete optimization problems are all around us. In cities, for example, planners try to place fire trucks so that every house can be reached within a fixed amount of time—say, five minutes. Mathematically, each fire truck “covers” whatever houses can be reached within five minutes from its location. The challenge is finding the minimal set of locations such that all houses are covered. “The whole [fire and emergency] profession has just adopted this coverage model, and it’s great,” says University of Wisconsin–Madison’s Laura Albert McLay. “It’s a nice, clear thing we can model.” But since a fire truck either exists at a location or it doesn’t, calculating that minimal set involves discrete optimization. And as McLay notes, “that’s where a lot of problems become computationally hard, when you can’t do half of this and half of that.”
离散优化的挑战也体现在社交场合。想象一下,你想为所有朋友和熟人举办一个派对,但又不想支付那么多邀请函所需的信封和邮票费用。你可以决定将邀请函寄给几个人脉广泛的朋友,并告诉他们“把我们认识的所有人都带过来”。那么,理想情况下,你希望找到的朋友圈中认识你所有其他人的最小群体——这样你就能用最少的信封,让每个人都来参加。诚然,这听起来可能只是为了省几块邮票钱而费力不讨好,但这正是政治竞选经理和企业营销人员想要解决的问题,以便最有效地传播他们的信息。这也是流行病学家在思考,比如说,一个群体中需要接种疫苗的最低人数——以及哪些人——来保护一个社会免受传染病侵害时所研究的问题。
The challenge of discrete optimization shows up in social settings, too. Imagine you wanted to throw a party for all your friends and acquaintances, but didn’t want to pay for all the envelopes and stamps that so many invitations would entail. You could instead decide to mail invitations to a few well-connected friends, and tell them to “bring everyone we know.” What you’d ideally want to find, then, is the smallest subgroup of your friends that knows all the rest of your social circle—which would let you lick the fewest envelopes and still get everyone to attend. Granted, this might sound like a lot of work just to save a few bucks on stamps, but it’s exactly the kind of problem that political campaign managers and corporate marketers want to solve to spread their message most effectively. And it’s also the problem that epidemiologists study in thinking about, say, the minimum number of people in a population—and which people—to vaccinate to protect a society from communicable diseases.
正如我们所指出的,离散优化对整数的限制——消防部门的车库里可以有一台、两台、三台消防车,但不能有两辆半消防车,也就是π辆消防车——正是离散优化问题难以解决的原因。事实上,消防车问题和派对邀请问题都是棘手的:它们没有通用的有效解决方案。但事实证明,确实存在一些有效的策略来解决这些问题的连续版本,其中任何分数或小数都是可能的解。面对离散优化问题的研究人员可能会羡慕这些策略——但他们还可以做得更多。他们可以尝试将离散问题简化为连续问题,看看会发生什么。
As we noted, discrete optimization’s commitment to whole numbers—a fire department can have one engine in the garage, or two, or three, but not two and a half fire trucks, or π of them—is what makes discrete optimization problems so hard to solve. In fact, both the fire truck problem and the party invitation problem are intractable: no general efficient solution for them exists. But, as it turns out, there do exist a number of efficient strategies for solving the continuous versions of these problems, where any fraction or decimal is a possible solution. Researchers confronted with a discrete optimization problem might gaze at those strategies enviously—but they also can do more than that. They can try to relax their discrete problem into a continuous one and see what happens.
就邀请函问题而言,将其从离散优化放宽到连续优化意味着,一个解决方案可能会告诉我们向某人发送四分之一的邀请函,而向另一个人发送三分之二的邀请函。这究竟意味着什么?这显然不可能是原始问题的答案,但就像最小生成树一样,它确实为我们提供了一个起点。有了放宽的解决方案,我们就可以决定如何将这些分数转化为现实。例如,我们可以选择根据需要简单地对它们进行四舍五入,在放宽方案中向所有收到“半份邀请函”或更多邀请函的人发送邀请。我们也可以将这些分数解释为概率——例如,对每个放宽方案告诉我们应该放置半辆消防车的位置抛硬币,只有当消防车正面朝上时,才会真正在那里放置一辆消防车。无论哪种情况,将这些分数转换回整数后,我们都能得到一个在原始离散问题背景下合理的解决方案。
In the case of the invitation problem, relaxing it from discrete to continuous optimization means that a solution may tell us to send someone a quarter of an invitation, and someone else two-thirds of one. What does that even mean? It obviously can’t be the answer to the original question, but, like the minimum spanning tree, it does give us a place to start. With the relaxed solution in hand, we can decide how to translate those fractions back into reality. We could, for example, choose to simply round them as necessary, sending invitations to everyone who got “half an invitation” or more in the relaxed scenario. We could also interpret these fractions as probabilities—for instance, flipping a coin for every location where the relaxed solution tells us to put half a fire truck, and actually placing a truck there only if it lands heads. In either case, with these fractions turned back to whole numbers, we’ll have a solution that makes sense in the context of our original, discrete problem.
与任何松弛法一样,最后一步是考察该解与我们通过详尽检查原始问题的每个可能答案得出的实际最佳解相比有多好。事实证明,对于邀请函问题,使用四舍五入的连续松弛法可以给出一个易于计算且相当不错的解:从数学上保证,它能邀请所有你想要的人参加派对,同时发出的邀请数量最多是暴力破解所能得到的最佳解的两倍。同样,在消防车问题中,使用概率连续松弛法可以快速地将我们引向最佳答案的合理范围之内。
The final step, as with any relaxation, is to ask how good this solution is compared to the actual best solution we might have come up with by exhaustively checking every single possible answer to the original problem. It turns out that for the invitations problem, Continuous Relaxation with rounding will give us an easily computed solution that’s not half bad: it’s mathematically guaranteed to get everyone you want to the party while sending out at most twice as many invitations as the best solution obtainable by brute force. Similarly, in the fire truck problem, Continuous Relaxation with probabilities can quickly get us within a comfortable bound of the optimal answer.
持续松弛法并非灵丹妙药:它仍然无法有效地找到真正最优的答案,而只能提供近似值。但即使邮件或疫苗接种的数量是最优值的两倍,也远胜于未经优化的替代方案。
Continuous Relaxation is not a magic bullet: it still doesn’t give us an efficient way to get to the truly optimal answers, only to their approximations. But delivering twice as many mailings or inoculations as optimal is still far better than the unoptimized alternatives.
只是一张超速罚单:拉格朗日松弛法
Just a Speeding Ticket: Lagrangian Relaxation
维齐尼:难以置信!
Vizzini: Inconceivable!
伊尼戈·蒙托亚:你一直在用这个词。我觉得它的意思和你想象的不一样。
Inigo Montoya: You keep using that word. I do not think it means what you think it means.
—公主新娘
—THE PRINCESS BRIDE
小时候,有一天,布莱恩向妈妈抱怨他不得不做的所有事情:作业、家务……“严格来说,你什么都不用做,”妈妈回答道。“你不必听老师的。你不必听我的话。你甚至不必遵守法律。凡事都有后果,而你自己决定是否要承担这些后果。”
One day as a child, Brian was complaining to his mother about all the things he had to do: his homework, his chores.… “Technically, you don’t have to do anything,” his mother replied. “You don’t have to do what your teachers tell you. You don’t have to do what I tell you. You don’t even have to obey the law. There are consequences to everything, and you get to decide whether you want to face those consequences.”
布莱恩的童心被震撼了。这是一个强有力的信息,唤醒了主体意识、责任感和道德判断力。它还有别的意义:一种名为拉格朗日松弛法的强大计算技术。拉格朗日松弛法背后的想法很简单。优化问题包含两部分:规则和计分。在拉格朗日松弛法中,我们将问题的一些约束条件融入到计分系统中。也就是说,我们将不可能的事情降级为昂贵的。(例如,在婚礼座位优化中,我们可能会放宽每张桌子最多可容纳 10 人的限制,允许桌子坐得太满,但会有一定的限制。)当优化问题的约束条件说“做,否则!”时,拉格朗日松弛法会回答“否则呢?”一旦我们能够突破界限 — — 即使只是一点点,即使成本很高 — — 以前难以处理的问题就会变得易于处理。
Brian’s kid-mind was blown. It was a powerful message, an awakening of a sense of agency, responsibility, moral judgment. It was something else, too: a powerful computational technique called Lagrangian Relaxation. The idea behind Lagrangian Relaxation is simple. An optimization problem has two parts: the rules and the scorekeeping. In Lagrangian Relaxation, we take some of the problem’s constraints and bake them into the scoring system instead. That is, we take the impossible and downgrade it to costly. (In a wedding seating optimization, for instance, we might relax the constraint that tables each hold ten people max, allowing overfull tables but with some kind of elbow-room penalty.) When an optimization problem’s constraints say “Do it, or else!,” Lagrangian Relaxation replies, “Or else what?” Once we can color outside the lines—even just a little bit, and even at a steep cost—problems become tractable that weren’t tractable before.
拉格朗日松弛法在旅行商问题和其他计算机科学难题的理论文献中占有重要地位。它们也是许多实际应用的关键工具。例如,回想一下卡内基梅隆大学的迈克尔·特里克,正如我们在第三章中提到的,他负责美国职业棒球大联盟和NCAA多个会议的赛程安排。我们之前没有提到的是他是如何做到的。每年赛程安排的制定都是一个巨大的离散优化问题,其复杂程度远超任何计算机的强力计算能力。因此,每年特里克和他在体育赛程安排小组的同事们都会采用拉格朗日松弛法来完成这项工作。每次你打开电视或在体育场就座时,你都会知道,那些球队在那个特定夜晚在那个球场上的对决……嗯,这不一定是最佳对决,但也差不多了。为此,我们不仅要感谢迈克尔·特里克,还要感谢十八世纪的法国数学家约瑟夫-路易斯·拉格朗日。
Lagrangian Relaxations are a huge part of the theoretical literature on the traveling salesman problem and other hard problems in computer science. They’re also a critical tool for a number of practical applications. For instance, recall Carnegie Mellon’s Michael Trick, who, as we mentioned in chapter 3, is in charge of scheduling for Major League Baseball and a number of NCAA conferences. What we hadn’t mentioned is how he does it. The composition of each year’s schedule is a giant discrete optimization problem, much too complex for any computer to solve by brute force. So each year Trick and his colleagues at the Sports Scheduling Group turn to Lagrangian Relaxation to get the job done. Every time you turn on the television or take a seat in a stadium, know that the meeting of those teams on that court on that particular night … well, it’s not necessarily the optimum matchup. But it’s close. And for that we have not only Michael Trick but eighteenth-century French mathematician Joseph-Louis Lagrange to thank.
在安排体育赛季时,特里克发现我们上面描述的“连续放松”策略并不一定能让他的工作变得更轻松。“如果最终的比赛场次是分数,那就什么也得不到。”派对邀请函或消防车的分配最终是分数,必要时可以进行四舍五入。但在体育运动中,整数约束——例如一场比赛有多少支球队参加、一共进行了多少场比赛以及每支球队与其他球队比赛的次数——实在太强了。“所以我们不能在这方面放松。我们必须保留模型的基本[离散]部分。”
In scheduling a sports season, Trick finds that the Continuous Relaxation we described above doesn’t necessarily make his life any easier. “If you end up with fractional games, you just don’t get anything useful.” It’s one thing to end up with fractional allocations of party invitations or fire trucks, where the numbers can always be rounded up if necessary. But in sports, the integer constraints—on how many teams play a game, how many games are played in sum, and how many times each team plays every other team—are just too strong. “And so we cannot relax in that direction. We really have got to keep the fundamental [discrete] part of the model.”
尽管如此,我们必须采取措施来应对问题的复杂性。因此,“我们必须与联盟合作,放宽他们可能想要的一些限制,”特里克解释说。在安排一个体育赛季时,这类限制的数量非常多,不仅包括联盟基本架构的要求,还包括各种特殊的要求和顾虑。有些联盟可以接受赛季后半段与前半段重复,只是主客场的比赛时间互换;其他联盟并不希望采用这种结构,但仍然要求任何球队在与其他所有球队交手一次之前,不得进行第二次交手。有些联盟坚持将最著名的对抗赛安排在赛季的最后一场比赛中。有些球队由于主场馆的活动冲突而无法在特定日期进行主场比赛。就NCAA篮球赛而言,特里克还必须考虑来自转播比赛的电视网络的进一步限制。电视台会提前一年确定他们预测的“A级比赛”和“B级比赛”,即那些能吸引最多观众的比赛。(例如,杜克大学对阵北卡罗来纳大学的比赛就是常年存在的A级比赛。)然后,电视台预计每周会有一场A级比赛和一场B级比赛——但绝不会同时安排两场A级比赛,以免分散观众。
Nonetheless, something has to be done to reckon with the sheer complexity of the problem. So “we have to work with the leagues to relax some of the constraints they might like to have,” Trick explains. The number of such constraints that go into scheduling a sports season is immense, and it includes not only the requirements arising from the league’s basic structure but also all sorts of idiosyncratic requests and qualms. Some leagues are fine with the second half of the season mirroring the first, just with home and away games reversed; other leagues don’t want that structure, but nonetheless demand that no teams meet for a second time until they’ve already met every other team once. Some leagues insist on making the most famous rivalries happen in the final game of the season. Some teams cannot play home games on certain dates due to conflicting events at their arenas. In the case of NCAA basketball, Trick also has to consider further constraints coming from the television networks that broadcast the games. Television channels define a year in advance what they anticipate “A games” and “B games” to be—the games that will attract the biggest audience. (Duke vs. UNC is a perennial A game, for instance.) The channels then expect one A game and one B game each week—but never two A games at the same time, lest it split the viewership.
毫不奇怪,考虑到所有这些要求,Trick 发现只有放宽一些硬性限制,才能计算出体育赛事时间表。
Unsurprisingly, given all these demands, Trick has found that computing a sports schedule often becomes possible only by softening some of these hard constraints.
一般来说,当人们第一次拿着体育赛事安排表来找我们时,他们会声称……“我们从不做x也从不做y。”然后我们看了看他们的安排表,然后说,“嗯,去年你们做了两次x,做了三次y。”然后“哦,是的,好吧,除此之外我们从不做。”然后我们回溯到前一年……我们通常意识到,有些事情他们认为他们从不做,但人们却会做。棒球界人士认为洋基队和大都会队从来不会同时在主场比赛。但这不是真的。从来都不是真的。他们一年中可能只有三场、六场在同一天在主场比赛。但在整个赛季中,每支球队都有 81 场主场比赛,这种情况相对罕见,人们会忘记他们。
Generally, when people first come to us with a sports schedule, they will claim … “We never do x and we never do y.” Then we look at their schedules and we say, “Well, twice you did x and three times you did y last year.” Then “Oh, yeah, well, okay. Then other than that we never do it.” And then we go back the year before.… We generally realize that there are some things they think they never do that people do do. People in baseball believe that the Yankees and the Mets are never at home at the same time. And it’s not true. It’s never been true. They are at home perhaps three games, perhaps six games in a year at the same day. But in the broad season, eighty-one games at home for each of the teams, it’s relatively rare, people forget about them.
有时需要一些外交技巧,但拉格朗日松弛法——将一些不可能的事情降为惩罚,将难以想象的事情降为不受欢迎的事情——能够推动进步。正如特里克所说,与其花费数年时间寻找遥不可及的完美答案,不如使用拉格朗日松弛法,让他能够提出诸如“你能接近多少?”之类的问题。事实证明,只要足够接近,就能让所有人——联盟、学校、电视网——都满意,并年复一年地点燃“疯狂三月”的火焰。
Occasionally it takes a bit of diplomatic finesse, but a Lagrangian Relaxation—where some impossibilities are downgraded to penalties, the inconceivable to the undesirable—enables progress to be made. As Trick says, rather than spending eons searching for an unattainable perfect answer, using Lagrangian Relaxation allows him to ask questions like, “How close can you get?” Close enough, it turns out, to make everyone happy—the league, the schools, the networks—and to stoke the flames of March Madness, year after year.
学会放松
Learning to Relax
在我们面临的各种计算问题中,优化问题(一部分是目标,一部分是规则)可以说是最常见的。而离散优化问题则是其中最典型的问题,在离散优化问题中,我们的选择要么是非此即彼,要么是非此即彼,没有中间地带。计算机科学在这方面给出了令人沮丧的结论。许多离散优化问题确实很难。该领域最聪明的头脑们每次尝试寻找一条通往完美答案的捷径都徒劳无功,事实上,他们越来越致力于证明这样的路径不存在,而不是去寻找它们。
Of the various ways that computational questions present themselves to us, optimization problems—one part goals, one part rules—are arguably the most common. And discrete optimization problems, where our options are stark either/or choices, with no middle ground, are the most typical of those. Here, computer science hands down a disheartening verdict. Many discrete optimization problems are truly hard. The field’s brightest minds have come up empty in every attempt to find an easy path to perfect answers, and in fact are increasingly more devoted to proving that such paths don’t exist than to searching for them.
即便如此,这至少能给我们带来一些安慰。如果我们遇到一个看起来棘手、棘手、无法解决的问题——好吧,我们可能是对的。而且拥有一台电脑也未必能帮上忙。
If nothing else, this should offer us some consolation. If we’re up against a problem that seems gnarly, thorny, impassable—well, we might be right. And having a computer won’t necessarily help.
至少,除非我们能够学会放松。
At least, not unless we can learn to relax.
有很多方法可以放松一个问题,我们已经看到了其中最重要的三种。第一种是约束放松,它简单地完全移除一些约束,并在问题回到现实之前在更宽松的形式上取得进展。第二种是连续放松,它将离散或二元选择变成连续的:当你在冰茶和柠檬水之间做选择时,首先想象一种 50:50 的“阿诺德·帕尔默”混合酒,然后将其向上或向下取整。第三种是拉格朗日放松,它将不可能变成纯粹的惩罚,教会你如何打破规则(或打破规则并承担后果)。例如,一个摇滚乐队在决定将哪些歌曲塞进一个有限的集合中时,就面临着计算机科学家所说的“背包问题”——这是一个要求玩家决定将一组不同体积和重要性的物品中的哪些物品塞进一个有限空间的谜题。严格来说,背包问题是出了名的难以解决,但这并不一定会让我们这些放松的摇滚明星灰心丧气。正如几个著名的例子所表明的那样,有时候,与其将演出限制在可用的时间段内,不如稍微超过城市宵禁时间并支付相关罚款。事实上,即使你没有违规,仅仅想象一下它也能给你带来启发。
There are many ways to relax a problem, and we’ve seen three of the most important. The first, Constraint Relaxation, simply removes some constraints altogether and makes progress on a looser form of the problem before coming back to reality. The second, Continuous Relaxation, turns discrete or binary choices into continua: when deciding between iced tea and lemonade, first imagine a 50–50 “Arnold Palmer” blend and then round it up or down. The third, Lagrangian Relaxation, turns impossibilities into mere penalties, teaching the art of bending the rules (or breaking them and accepting the consequences). A rock band deciding which songs to cram into a limited set, for instance, is up against what computer scientists call the “knapsack problem”—a puzzle that asks one to decide which of a set of items of different bulk and importance to pack into a confined volume. In its strict formulation the knapsack problem is famously intractable, but that needn’t discourage our relaxed rock stars. As demonstrated in several celebrated examples, sometimes it’s better to simply play a bit past the city curfew and incur the related fines than to limit the show to the available slot. In fact, even when you don’t commit the infraction, simply imagining it can be illuminating.
英国保守派专栏作家克里斯托弗·布克曾说:“当我们在无意识中被一厢情愿的想法所驱使时,一切似乎都会在一段时间内进展顺利”——但因为“这种幻想永远无法与现实相协调”,它将不可避免地导致他所描述的多阶段崩溃:“梦想”、“沮丧”、“噩梦”、“爆发”。计算机科学描绘了一幅远为美好的景象。然而,作为一种优化技术,放松完全在于被一厢情愿的想法有意识地驱使。或许这正是造成差异的部分原因。
The conservative British columnist Christopher Booker says that “when we embark on a course of action which is unconsciously driven by wishful thinking, all may seem to go well for a time”—but that because “this make-believe can never be reconciled with reality,” it will inevitably lead to what he describes as a multi-stage breakdown: “dream,” “frustration,” “nightmare,” “explosion.” Computer science paints a dramatically rosier view. Then again, as an optimization technique, relaxation is all about being consciously driven by wishful thinking. Perhaps that’s partly what makes the difference.
放松策略给我们带来了许多好处。首先,它们对真正解决方案的质量设定了界限。如果我们试图把日程安排得满满当当,想象一下我们能神奇地穿越到城市的另一边,就会立刻明白,我们一天最多只能安排八场一小时的会议;这样的界限可能有助于我们在面对整个问题之前设定预期。其次,放松策略的设计使得它们确实能够与现实相协调——这从另一个方向为我们提供了解决方案的界限。当持续放松策略告诉我们要分发部分疫苗时,我们可以只给所有被分配接种一半或更多疫苗的人接种,最终得到一个易于计算的解决方案,该解决方案所需的接种量最多是理想情况下的两倍。也许我们可以接受这一点。
Relaxations offer us a number of advantages. For one, they offer a bound on the quality of the true solution. If we’re trying to pack our calendar, imagining that we can magically teleport across town will instantaneously make it clear that eight one-hour meetings is the most we could possibly expect to fit into a day; such a bound might be useful in setting expectations before we face the full problem. Second, relaxations are designed so that they can indeed be reconciled with reality—and this gives us bounds on the solution from the other direction. When Continuous Relaxation tells us to give out fractional vaccines, we can just immunize everyone assigned to receive half a vaccine or more, and end up with an easily calculated solution that requires at worst twice as many inoculations as in a perfect world. Maybe we can live with that.
除非我们愿意每次遇到困难都花费无数年的时间追求完美,否则,面对难题,我们不应该空想,而应该先设想更简单的方案,并先解决它们。如果运用得当,这绝非痴心妄想,也不是空想或白日梦。这是我们取得进步的最佳途径之一。
Unless we’re willing to spend eons striving for perfection every time we encounter a hitch, hard problems demand that instead of spinning our tires we imagine easier versions and tackle those first. When applied correctly, this is not just wishful thinking, not fantasy or idle daydreaming. It’s one of our best ways of making progress.
*鉴于O ( n² ) 在排序环境中显得如此可恶,在这里称其为“高效”可能看起来很奇怪。但事实是,即使是像O ( 2n )这样基数很小的指数时间,与基数很大的多项式(如n 10 )相比,也会很快变得非常困难。在某个问题规模下,指数总会超过多项式——在这种情况下,如果你要对几十个以上的物品进行排序,那么与2n相比, n 10看起来就像是公园里散步一样。自从 Cobham 和 Edmonds 的工作以来,“多项式”(n到某物)和“指数”(某物到 n )之间的鸿沟就成了该领域事实上的越界标志。
*It may look strange, given that O(n2) seemed so odious in the sorting context, to call it “efficient” here. But the truth is that even exponential time with an unassumingly small base number, like O(2n), quickly gets hellish even when compared to a polynomial with a large base, like n10. The exponent will always overtake the polynomial at some problem size—in this case, if you’re sorting more than several dozen items, n10 starts to look like a walk in the park compared to 2n. Ever since Cobham and Edmonds’s work, this chasm between “polynomials” (n-to-the-something) and “exponentials” (something-to-the-n) has served as the field’s de facto out-of-bounds marker.
我必须承认,在这个领域工作多年之后,随机性对如此多算法问题的有效性对我来说仍然是个谜。它高效,有效;但其原理和机制却依然是个谜。
I must admit that after many years of work in this area, the efficacy of randomness for so many algorithmic problems is absolutely mysterious to me. It is efficient, it works; but why and how is absolutely mysterious.
—迈克尔·拉宾
—MICHAEL RABIN
随机性似乎与理性截然相反——一种放弃解决问题的方式,一种不得已的手段。然而,事实远非如此。随机性在计算机科学中令人惊奇且日益重要的作用,表明利用偶然性可以成为解决最棘手问题的有效途径。事实上,有时别无他法。
Randomness seems like the opposite of reason—a form of giving up on a problem, a last resort. Far from it. The surprising and increasingly important role of randomness in computer science shows us that making use of chance can be a deliberate and effective part of approaching the hardest sets of problems. In fact, there are times when nothing else will do.
我们通常认为计算机会使用标准的“确定性”算法,即每次都以完全相同的方式完成一个步骤,而随机算法则使用随机生成的数字来解决问题。计算机科学的最新研究表明,在某些情况下,随机算法能够比所有已知的确定性算法更快地为难题提供良好的近似答案。虽然随机算法并不总是能保证获得最优解,但它们只需在确定性算法苦苦挣扎的过程中,策略性地抛几个硬币,就能在极短的时间内惊人地接近最优解。
In contrast to the standard “deterministic” algorithms we typically imagine computers using, where one step follows from another in exactly the same way every time, a randomized algorithm uses randomly generated numbers to solve a problem. Recent work in computer science has shown that there are cases where randomized algorithms can produce good approximate answers to difficult questions faster than all known deterministic algorithms. And while they do not always guarantee the optimal solutions, randomized algorithms can get surprisingly close to them in a fraction of the time, just by strategically flipping a few coins while their deterministic cousins sweat it out.
在某些问题上,随机方法甚至可能胜过最好的确定性方法,这一事实蕴含着深刻的道理。有时,解决问题的最佳方案是寻求机会,而不是试图完全推理出答案。
There is a deep message in the fact that on certain problems, randomized approaches can outperform even the best deterministic ones. Sometimes the best solution to a problem is to turn to chance rather than trying to fully reason out an answer.
但仅仅知道随机性有用是不够的。你需要知道何时、以何种方式以及在多大程度上依赖随机性。计算机科学的近代史提供了一些答案——尽管这个故事始于几个世纪之前。
But merely knowing that randomness can be helpful isn’t good enough. You need to know when to rely on chance, in what way, and to what extent. The recent history of computer science provides some answers—though the story begins a couple of centuries earlier.
采样
Sampling
1777年,乔治-路易·勒克莱尔(布丰伯爵)发表了一项有趣的概率分析结果。他问道,如果我们将一根针放在一张有横线的纸上,它穿过其中一条线的概率有多大?布丰的研究表明,如果针的长度小于横线之间的间隙,那么答案就是2 ⁄ π乘以针的长度除以间隙的长度。对布丰来说,推导出这个公式就足够了。但在1812年,第六章的贡献者之一皮埃尔-西蒙·拉普拉斯指出,这个结果还有另一层含义:人们可以简单地通过将针放在纸上来估算π的值。
In 1777, George-Louis Leclerc, Comte de Buffon, published the results of an interesting probabilistic analysis. If we drop a needle onto a lined piece of paper, he asked, how likely is it to cross one of the lines? Buffon’s work showed that if the needle is shorter than the gap between the blines, the answer is 2⁄π times the needle’s length divided by the length of the gap. For Buffon, deriving this formula was enough. But in 1812, Pierre-Simon Laplace, one of the heroes of chapter 6, pointed out that this result has another implication: one could estimate the value of π simply by dropping needles onto paper.
拉普拉斯的提议指出了一个深刻的普遍真理:当我们想了解一个复数时,我们可以通过从中抽样来估算它的值。这正是他关于贝叶斯规则的研究成果帮助我们进行的计算。事实上,根据拉普拉斯的建议,一些人已经进行了与他完全相同的实验,证实了用这种实际操作的方法估算π的值是可能的——尽管效率并不高。 *
Laplace’s proposal pointed to a profound general truth: when we want to know something about a complex quantity, we can estimate its value by sampling from it. This is exactly the kind of calculation that his work on Bayes’s Rule helps us to perform. In fact, following Laplace’s suggestion, several people have carried out exactly the experiment he suggested, confirming that it is possible—although not particularly efficient—to estimate the value of π in this hands-on way.*
对某些人来说,将数千根针头扔到横格纸上是一项有趣的消遣,但直到计算机的发展,采样才成为一种实用的方法。以前,当数学家和物理学家尝试利用随机性解决问题时,他们的计算必须费力地手工完成,因此很难生成足够的样本来获得准确的结果。计算机——尤其是二战期间在洛斯阿拉莫斯研发的计算机——带来了巨大的改变。
Throwing thousands of needles onto lined paper makes for an interesting pastime (for some), but it took the development of the computer to make sampling into a practical method. Before, when mathematicians and physicists tried using randomness to solve problems, their calculations had to be laboriously worked out by hand, so it was hard to generate enough samples to yield accurate results. Computers—in particular, the computer developed in Los Alamos during World War II—made all the difference.
斯坦尼斯瓦夫·“斯坦”·乌拉姆是参与研制原子弹的数学家之一。他在波兰长大,1939年移居美国,并于1943年加入曼哈顿计划。短暂重返学术界后,他于1946年回到洛斯阿拉莫斯,致力于热核武器的设计。但他当时也病了——他患了脑炎,接受了紧急脑部手术。康复期间,他一直担心自己能否恢复数学能力。
Stanislaw “Stan” Ulam was one of the mathematicians who helped develop the atomic bomb. Having grown up in Poland, he moved to the United States in 1939, and joined the Manhattan Project in 1943. After a brief return to academia he was back at Los Alamos in 1946, working on the design of thermonuclear weapons. But he was also sick—he had contracted encephalitis, and had emergency brain surgery. And as he recovered from his illness he worried about whether he would regain his mathematical abilities.
康复期间,乌拉姆玩了很多牌,尤其是单人纸牌(又称克朗代克纸牌)。任何单人纸牌玩家都知道,有些洗牌方式会导致无法取胜。因此,乌拉姆在玩牌时,自然而然地问了自己一个问题:洗牌后,一副牌能赢的概率有多大?
While convalescing, Ulam played a lot of cards, particularly solitaire (a.k.a. Klondike). As any solitaire player knows, some shuffles of the deck produce games that just can’t be won. So as Ulam played, he asked himself a natural question: what is the probability that a shuffled deck will yield a winnable game?
在像单人纸牌这样的游戏中,在各种可能性的空间中推理几乎会立刻让人不知所措。翻开第一张牌,有52种可能的玩法需要记录;翻开第二张牌,每张牌又有51种可能性。这意味着,在我们开始玩之前,我们就已经想到了数千种可能的玩法。F·斯科特·菲茨杰拉德曾经写道:“检验一流智力的标准,是能够同时在脑海中容纳两种截然相反的想法,并且仍然保持运作的能力。” 这或许没错,但无论是人类还是其他生物,任何一流智力都不可能在脑海中记住洗牌后的80亿亿次可能的顺序,并且仍然保持运作的希望。
In a game like solitaire, reasoning your way through the space of possibilities gets almost instantly overwhelming. Flip over the first card, and there are fifty-two possible games to keep track of; flip over the second, and there are fifty-one possibilities for each first card. That means we’re already up into thousands of possible games before we’ve even begun to play. F. Scott Fitzgerald once wrote that “the test of a first-rate intelligence is the ability to hold two opposing ideas in mind at the same time and still retain the ability to function.” That may be true, but no first-rate intelligence, human or otherwise, can possibly hold the eighty unvigintillion possible shuffled-deck orders in mind and have any hope of functioning.
在尝试了一些此类复杂的组合计算并放弃之后,乌拉姆想到了一种不同的方法,这种方法简单而美妙:只玩游戏。
After trying some elaborate combinatorial calculations of this sort and giving up, Ulam landed on a different approach, beautiful in its simplicity: just play the game.
我注意到,[尝试]……先把牌放下来,或者试验一下这个过程,然后仅仅观察一下成功的比例,可能比试图计算所有组合可能性要实际得多。组合可能性是一个指数级增长的数字,大到除了非常基本的情况外,根本无法估算。这在智力上令人惊讶,即使不至于让人感到羞愧,也让人对理性或传统思维的局限性感到谦卑。在一个足够复杂的问题中,实际抽样比检查所有可能性链更有效。
I noticed that it may be much more practical to [try] … laying down the cards, or experimenting with the process and merely noticing what proportion comes out successfully, rather than to try to compute all the combinatorial possibilities which are an exponentially increasing number so great that, except in very elementary cases, there is no way to estimate it. This is intellectually surprising, and if not exactly humiliating, it gives one a feeling of modesty about the limits of rational or traditional thinking. In a sufficiently complicated problem, actual sampling is better than an examination of all the chains of possibilities.
当他说“更好”时,请注意,他并不一定意味着抽样会比详尽分析提供更精确的答案:抽样过程总是会有一些误差,尽管你可以通过确保样本确实是随机的,并增加抽样数量来减少误差。他的意思是,抽样更好,因为在其他方法都无法提供答案的情况下,它最终能提供答案。
When he says “better,” note that he doesn’t necessarily mean that sampling will offer you more precise answers than exhaustive analysis: there will always be some error associated with a sampling process, though you can reduce it by ensuring your samples are indeed random and by taking more and more of them. What he means is that sampling is better because it gives you an answer at all, in cases where nothing else will.
乌拉姆的洞见——即使分析失败,采样也能成功——对于解决洛斯阿拉莫斯实验室出现的一些核物理难题也至关重要。核反应是一个分支过程,其中可能性的倍增就像纸牌一样疯狂:一个粒子分裂成两个,每个粒子都可能继续撞击其他粒子,导致它们依次分裂,如此反复。在众多粒子相互作用的情况下,精确计算该过程中某个特定结果的概率几乎是不可能的。但模拟这个过程,将每次相互作用都视为翻开一张新牌,则提供了一种替代方案。
Ulam’s insight—that sampling can succeed where analysis fails—was also crucial to solving some of the difficult nuclear physics problems that arose at Los Alamos. A nuclear reaction is a branching process, where possibilities multiply just as wildly as they do in cards: one particle splits in two, each of which may go on to strike others, causing them to split in turn, and so on. Exactly calculating the chances of some particular outcome of that process, with many, many particles interacting, is hard to the point of impossibility. But simulating it, with each interaction being like turning over a new card, provides an alternative.
乌拉姆与约翰·冯·诺依曼进一步发展了这一想法,并与曼哈顿计划的另一位物理学家尼古拉斯·梅特罗波利斯合作,在洛斯阿拉莫斯的计算机上实现了该方法。梅特罗波利斯将这种方法——用样本模拟取代详尽的概率计算——命名为蒙特卡罗方法,以纪念摩纳哥的蒙特卡罗赌场,一个同样依赖于随机性的地方。洛斯阿拉莫斯团队能够利用它解决核物理中的关键问题。如今,蒙特卡罗方法已成为科学计算的基石之一。
Ulam developed the idea further with John von Neumann, and worked with Nicholas Metropolis, another of the physicists from the Manhattan Project, on implementing the method on the Los Alamos computer. Metropolis named this approach—replacing exhaustive probability calculations with sample simulations—the Monte Carlo Method, after the Monte Carlo casino in Monaco, a place equally dependent on the vagaries of chance. The Los Alamos team was able to use it to solve key problems in nuclear physics. Today the Monte Carlo Method is one of the cornerstones of scientific computing.
许多这类问题,例如计算亚原子粒子的相互作用,或者计算单人纸牌游戏的获胜概率,本身就具有概率性,因此通过蒙特卡洛这样的随机方法来解决这些问题颇有道理。但关于随机性威力最令人惊讶的认识或许在于,它可以在机会看似毫无作用的情境中发挥作用。即使你想要一个严格意义上是“是”或“否”、真或假的问题的答案——没有任何概率——掷几个骰子或许仍然能够找到答案。
Many of these problems, like calculating the interactions of subatomic particles or the chances of winning at solitaire, are themselves intrinsically probabilistic, so solving them through a randomized approach like Monte Carlo makes a fair bit of sense. But perhaps the most surprising realization about the power of randomness is that it can be used in situations where chance seemingly plays no role at all. Even if you want the answer to a question that is strictly yes or no, true or false—no probabilities about it—rolling a few dice may still be part of the solution.
随机算法
Randomized Algorithms
迈克尔·拉宾(Michael Rabin)是第一个展现随机性在计算机科学中惊人广泛应用的人。拉宾1931年出生于德国布雷斯劳(二战结束后,布雷斯劳改名为波兰弗罗茨瓦夫),是拉比世家的后裔。1935年,他的家人离开德国前往巴勒斯坦。在那里,他被数学之美所吸引,放弃了父亲为他铺就的拉比之路——在希伯来大学读本科期间,他发现了艾伦·图灵的著作,并移民到美国,在普林斯顿大学攻读博士学位。拉宾后来获得了图灵奖——相当于计算机科学界的诺贝尔奖——因为他扩展了理论计算机科学,使其能够处理“非确定性”的情况,即机器并非被迫选择单一选项,而是有多种路径可供选择。1975年,拉宾在休假期间来到麻省理工学院,寻找新的研究方向。
The first person to demonstrate the surprisingly broad applications of randomness in computer science was Michael Rabin. Born in 1931 in Breslau, Germany (which became Wrocław, Poland, at the end of World War II), Rabin was the descendant of a long line of rabbis. His family left Germany for Palestine in 1935, and there he was diverted from the rabbinical path his father had laid down for him by the beauty of mathematics—discovering Alan Turing’s work early in his undergraduate career at the Hebrew University and immigrating to the United States to begin a PhD at Princeton. Rabin would go on to win the Turing Award—the computer science equivalent of a Nobel—for extending theoretical computer science to accommodate “nondeterministic” cases, where a machine isn’t forced to pursue a single option but has multiple paths it might follow. On sabbatical in 1975, Rabin came to MIT, searching for a new research direction to pursue.
他在一个最古老的问题中找到了它:如何识别素数。
He found it in one of the oldest problems of them all: how to identify prime numbers.
寻找素数的算法至少可以追溯到古希腊,当时的数学家使用一种称为埃拉斯托尼筛法的简单方法。埃拉斯托尼筛法的工作原理如下:要找到所有小于n的素数,首先按顺序写下从 1 到n的所有数字。然后划掉除其本身之外的所有 2 的倍数的数字(4、6、8、10、12等)。取下一个未被划掉的最小数字(在本例中为 3),然后划掉该数字的所有倍数(6、9、12、15)。继续这样做,最后剩下的数字就是素数。
Algorithms for finding prime numbers date back at least as far as ancient Greece, where mathematicians used a straightforward approach known as the Sieve of Erastothenes. The Sieve of Erastothenes works as follows: To find all the primes less than n, begin by writing down all the numbers from 1 to n in sequence. Then cross out all the numbers that are multiples of 2, besides itself (4, 6, 8, 10, 12, and so on). Take the next smallest number that hasn’t been crossed out (in this case, 3), and cross out all multiples of that number (6, 9, 12, 15). Keep going like this, and the numbers that remain at the end are the primes.
几千年来,素数研究一直被认为是数学中“最明显无用的分支之一”(正如G. H. Hardy所言)。但它在20世纪才开始走向实用,成为密码学和网络安全领域的关键。事实上,将素数相乘比分解因数要容易得多。如果素数足够大——比如一千位——乘法可以在几分之一秒内完成,而分解因数则可能需要数百万年;这就形成了所谓的“单向函数”。例如,在现代加密技术中,只有发送者和接收者知道的秘密素数相乘,得到巨大的合数,这些合数可以公开传输而不必担心,因为分解乘积的因数会花费任何窃听者都无法承受的时间。因此,几乎所有安全的在线通信——无论是商业、银行业务还是电子邮件——都始于对素数的搜寻。
For millennia, the study of prime numbers was believed to be, as G. H. Hardy put it, “one of the most obviously useless branches” of mathematics. But it lurched into practicality in the twentieth century, becoming pivotal in cryptography and online security. As it happens, it is much easier to multiply primes together than to factor them back out. With big enough primes—say, a thousand digits—the multiplication can be done in a fraction of a second while the factoring could take literally millions of years; this makes for what is known as a “one-way function.” In modern encryption, for instance, secret primes known only to the sender and recipient get multiplied together to create huge composite numbers that can be transmitted publicly without fear, since factoring the product would take any eavesdropper way too long to be worth attempting. Thus virtually all secure communication online—be it commerce, banking, or email—begins with a hunt for prime numbers.
这种密码学应用突然使得查找和检验素数的算法变得异常重要。埃拉斯托尼筛法虽然有效,但效率不高。如果你想检验某个数是否为素数(即测试其“素性”),那么按照筛法,你需要尝试将其除以直到其平方根的所有素数。*检验一个六位数是否为素数需要除以小于 1,000 的所有 168 个素数——这还不算太糟。但检验一个十二位数需要除以小于 1,000 的 78,498 个素数,所有这些除法很快就会失控。现代密码学中使用的素数有数百位数字那么长;别指望它了。
This cryptographic application suddenly made algorithms for finding and checking primes incredibly important. And while the Sieve of Erastothenes is effective, it is not efficient. If you want to check whether a particular number is prime—known as testing its “primality”—then following the sieve strategy requires trying to divide it by all the primes up to its square root.* Checking whether a six-digit number is prime would require dividing by all of the 168 primes less than 1,000—not so bad. But checking a twelve-digit number involves dividing by the 78,498 primes less than 1 million, and all that division quickly starts to get out of control. The primes used in modern cryptography are hundreds of digits long; forget about it.
在麻省理工学院,拉宾遇到了刚从伯克利大学计算机科学系毕业的加里·米勒。米勒在他的博士论文中开发了一种极具潜力、速度更快的素数检测算法——但它存在一个小问题:它并不总是有效。
At MIT, Rabin ran into Gary Miller, a recent graduate from the computer science department at Berkeley. In his PhD thesis, Miller had developed an intriguingly promising, much faster algorithm for testing primality—but there was one small problem: it didn’t always work.
米勒发现了一组方程(用两个数字n和x表示),只要n为素数,无论代入x的数值如何,这些方程都始终成立。如果即使x只有一个值,这些方程的结果是假的,那么n就不可能是素数——在这种情况下,x被称为“反对素数性的证人”。然而,问题在于假阳性:即使n不是素数,这些方程有时仍会成立。这似乎让米勒的方法悬而未决。
Miller had found a set of equations (expressed in terms of two numbers, n and x) that are always true if n is prime, regardless of what values you plug in for x. If they come out false even for a single value of x, then there’s no way n can be prime—in these cases, x is called a “witness” against primality. The problem, though, is false positives: even when n is not prime, the equations will still come out true some of the time. This seemed to leave Miller’s approach hanging.
拉宾意识到,在这一领域,跳出通常确定性的计算机科学世界可能会很有价值。如果数字n实际上不是素数,那么有多少个可能的x值会给出假阳性并将其宣布为素数?拉宾表示,答案是不超过四分之一。因此,对于随机的x值,如果米勒方程成立,那么n实际上不是素数的概率只有四分之一。至关重要的是,每次我们随机抽取一个新的x并检验米勒方程时,n看起来是素数但实际上不是素数的概率就会下降四倍。重复该过程十次,假阳性的概率是四分之一的十次方——不到百万分之一。还是不够确定?再检查五次,就降到十亿分之一了。
Rabin realized that this was a place where a step outside the usually deterministic world of computer science might be valuable. If the number n is actually nonprime, how many possible values of x would give a false positive and declare it a prime number? The answer, Rabin showed, is no more than one-quarter. So for a random value of x, if Miller’s equations come out true, there’s only a one-in-four chance that n isn’t actually prime. And crucially, each time we sample a new random x and Miller’s equations check out, the probability that n only seems prime, but isn’t really, drops by another multiple of four. Repeat the procedure ten times, and the probability of a false positive is one in four to the tenth power—less than one in a million. Still not enough certainty? Check another five times and you’re down to one in a billion.
麻省理工学院的另一位计算机科学家沃恩·普拉特(Vaughan Pratt)实现了拉宾的算法,并在一个冬夜开始得到结果。当时拉宾正待在家里,邀请朋友们来参加光明节派对。拉宾记得自己在午夜时分接到了一个电话:
Vaughan Pratt, another computer scientist at MIT, implemented Rabin’s algorithm and started getting results late one winter night, while Rabin was at home having friends over for a Hanukkah party. Rabin remembers getting a call around midnight:
“迈克尔,我是沃恩。我正在计算这些实验的结果。拿张纸笔,把这个记下来。” 于是他得出 2400−593是素数。所有小于 300 的素数p的乘积都记为k。k × 338 + 821和k × 338 + 823 是孪生素数。*这两个数是当时已知的最大孪生素数。我毛骨悚然。这太不可思议了。简直不可思议。
“Michael, this is Vaughan. I’m getting the output from these experiments. Take a pencil and paper and write this down.” And so he had that 2400−593 is prime. Denote the product of all primes p smaller than 300 by k. The numbers k × 338 + 821 and k × 338 + 823 are twin primes.* These constituted the largest twin primes known at the time. My hair stood on end. It was incredible. It was just incredible.
现在人们所熟知的米勒-拉宾素数测试提供了一种快速识别甚至巨大素数的方法,并且具有任意的确定性。
The Miller-Rabin primality test, as it’s now known, provides a way to quickly identify even gigantic prime numbers with an arbitrary degree of certainty.
这里我们或许可以提出一个哲学问题——“是”的含义究竟是什么。我们已经习惯了数学是确定性的领域,所以想到一个数字“很可能是素数”或“几乎肯定是素数”会让人感到震惊。到底要多确定才算足够确定?实际上,现代加密系统(用于加密互联网连接和数字交易的系统)的误报率已经调整到不到百万亿亿分之一。换句话说,那是一个以二十四个零开头的小数——对于地球上的沙粒数量来说,出现的假素数还少一个。这一标准是在仅仅应用了四十次米勒-拉宾检验之后得出的。诚然,你永远无法完全确定——但你可以非常迅速地接近它。
Here we might ask a philosophical question—about what the meaning of “is” is. We’re so used to mathematics being a realm of certainty that it’s jarring to think that a number could be “probably prime” or “almost definitely prime.” How certain is certain enough? In practice, modern cryptographic systems, the ones that encrypt Internet connections and digital transactions, are tuned for a false positive rate of less than one in a million billion billion. In other words, that’s a decimal that begins with twenty-four zeros—less than one false prime for the number of grains of sand on Earth. This standard comes after a mere forty applications of the Miller-Rabin test. It’s true that you are never fully certain—but you can get awfully close, awfully quick.
虽然你可能从未听说过米勒-拉宾检验,但你的笔记本电脑、平板电脑和手机对它却了如指掌。几十年后,它仍然是许多领域中查找和检验素数的标准方法。无论你在网上使用信用卡,还是几乎任何时候通过无线或有线方式发送安全通信,它都在幕后运作。
Though you may have never heard of the Miller-Rabin test, your laptop, tablet, and phone know it well. Several decades after its discovery, it is still the standard method used to find and check primes in many domains. It’s working behind the scenes whenever you use your credit card online, and almost any time secure communications are sent through the air or over wires.
在米勒和拉宾的工作发表后的几十年里,人们一直不知道是否存在一种有效的算法,能够以确定性的方式、绝对肯定地测试素数。2002年,印度理工学院的马宁德拉·阿格拉瓦尔(Manindra Agrawal)、尼拉杰·卡亚尔(Neeraj Kayal)和尼廷·萨克塞纳(Nitin Saxena)确实发现了一种这样的方法——但像米勒-拉宾这样的随机算法速度要快得多,因此至今仍在实践中使用。
For decades after Miller and Rabin’s work, it wasn’t known whether there would ever be an efficient algorithm that allows testing primality in deterministic fashion, with absolute certainty. In 2002, one such method did get discovered by Manindra Agrawal, Neeraj Kayal, and Nitin Saxena at the Indian Institute of Technology—but randomized algorithms like Miller-Rabin are much faster and thus are still the ones used in practice today.
对于其他一些问题,随机性仍然是唯一已知的有效解决方案。数学中一个有趣的例子被称为“多项式恒等式检验”。如果你有两个多项式表达式,例如 2 x 3 + 13 x 2 + 22 x + 8 和 (2 x + 1) × ( x + 2) × ( x + 4),要确定这两个表达式是否是同一个函数(通过进行所有乘法运算,然后比较结果),可能会非常耗时,尤其是在变量数量增加的情况下。
And for some other problems, randomness still provides the only known route to efficient solutions. One curious example from mathematics is known as “polynomial identity testing.” If you have two polynomial expressions, such as 2x3 + 13x2 + 22x + 8 and (2x + 1) × (x + 2) × (x + 4), working out whether those expressions are in fact the same function—by doing all the multiplication, then comparing the results—can be incredibly time-consuming, especially as the number of variables increases.
随机性再次提供了一种解决方案:只需生成一些随机x并将它们代入即可。如果两个表达式不同,那么如果它们对某些随机生成的输入给出了相同的答案,那将是一个很大的巧合。如果它们对第二个随机输入也给出了相同的答案,那么巧合就更大了。如果它们连续对三个随机输入都给出了相同的答案,那么巧合就更大了。由于目前尚无已知的确定性算法可以有效地测试多项式恒等式,因此这种随机方法——通过多次观察迅速得出近乎确定的结果——是我们唯一可行的方法。
Here again randomness offers a way forward: just generate some random xs and plug them in. If the two expressions are not the same, it would be a big coincidence if they gave the same answer for some randomly generated input. And an even bigger coincidence if they also gave identical answers for a second random input. And a bigger coincidence still if they did it for three random inputs in a row. Since there is no known deterministic algorithm for efficiently testing polynomial identity, this randomized method—with multiple observations quickly giving rise to near-certainty—is the only practical one we have.
赞美采样
In Praise of Sampling
多项式恒等式检验表明,有时我们最好花些精力去检查随机值——从我们想要了解的两个表达式中取样——而不是试图理清它们的内部工作原理。在某种程度上,这似乎相当直观。假设有两个不起眼的小玩意儿,我们问它们是两个不同的设备还是同一个设备的两个副本,大多数人会开始随意按按钮,而不是打开外壳检查线路。而且,当一个电视毒枭为了大致确定整批货物的质量而用刀随机打开几包货物时,我们也不会特别惊讶。
The polynomial identity test shows that sometimes our effort is better spent checking random values—sampling from the two expressions we want to know about—than trying to untangle their inner workings. To some extent this seems reasonably intuitive. Given a pair of nondescript gadgets and asked whether they are two different devices or two copies of the same one, most of us would start pushing random buttons rather than crack open the cases to examine the wiring. And we aren’t particularly surprised when, say, a television drug lord knifes open a few bundles at random to be reasonably certain about the quality of the entire shipment.
不过,有些情况下我们并不会求助于随机性——但也许我们应该这样做。
There are cases, though, where we don’t turn to randomness—and maybe we should.
可以说,二十世纪最重要的政治哲学家是哈佛大学的约翰·罗尔斯,他为自己设定了一项雄心勃勃的任务,即调和他所在领域中两个看似对立的关键理念:自由和平等。一个社会越自由就越“公正”,还是越平等就越“公正”?这两者真的必须互相排斥吗?罗尔斯提供了一种解决这一系列问题的方法,他称之为“无知之幕”。他说,想象一下,你即将出生,但不知道你是谁:男性或女性、富人或穷人、城市或农村、病人或健康。在了解你的身份之前,你必须选择你想要生活在什么样的社会中。你想要什么?罗尔斯认为,通过在无知之幕后面评估各种社会安排,我们更容易就理想的社会安排达成共识。
Arguably the most important political philosopher of the twentieth century was Harvard’s John Rawls, who set for himself the ambitious task of reconciling two seemingly opposite key ideas in his field: liberty and equality. Is a society more “just” when it’s more free, or more equal? And do the two really have to be mutually exclusive? Rawls offered a way of approaching this set of questions that he called the “veil of ignorance.” Imagine, he said, that you were about to be born, but didn’t know as whom: male or female, rich or poor, urban or rural, sick or healthy. And before learning your status, you had to choose what kind of society you’d live in. What would you want? By evaluating various social arrangements from behind the veil of ignorance, argued Rawls, we’d more readily come to a consensus about what an ideal one would look like.
然而,罗尔斯的思想实验没有考虑到,在这样的帷幕背后理解社会的计算成本。在这种假设的情境下,我们怎么可能指望将所有相关信息都记在脑子里呢?暂且把正义和公平等宏大问题放在一边,试着将罗尔斯的方法仅仅应用于,比如说,一项拟议的医疗保险法规变更。假设你出生在中西部,长大后成为镇书记员的概率;乘以中西部各城市政府雇员可获得的不同医疗保健计划的分布;乘以提供例如胫骨骨折概率的精算数据;乘以在给定各种保险计划分布的情况下,中西部医院胫骨骨折平均手术的平均医疗费用……好吧,那么,拟议的保险修订对国家来说是“好”还是“坏”呢?我们几乎无法通过这种方式来评估一只受伤的小腿,更不用说数亿人的生命了。
What Rawls’s thought experiment does not take into account, however, is the computational cost of making sense of a society from behind such a veil. How could we, in this hypothetical scenario, possibly hope to hold all of the relevant information in our heads? Set aside grand questions of justice and fairness for a moment and try to apply Rawls’s approach merely to, say, a proposed change in health insurance regulations. Take the probability of being born, perhaps, as someone who grows up to become a town clerk in the Midwest; multiply that by the distribution of the different health care plans available to government employees across various midwestern municipalities; multiply that by actuarial data that offer the probability of, for instance, a fractured tibia; multiply that by the average medical bill for the average procedure for a fractured tibia at a midwestern hospital given the distribution of possible insurance plans.… Okay, so would the proposed insurance revision be “good” or “bad” for the nation? We can barely hope to evaluate a single injured shin this way, let alone the lives of hundreds of millions.
罗尔斯的哲学批评者们就我们究竟应该如何利用从无知之幕中获得的信息进行了长篇大论的探讨。例如,我们应该努力最大化平均幸福、中位数幸福、总体幸福,还是其他什么?众所周知,这些方法都容易导致恶性反乌托邦的出现——例如作家厄休拉·勒古恩所想象的奥梅拉斯文明,那里繁荣和谐,却只有一个孩子被迫生活在极度痛苦之中。这些都是值得批判的,罗尔斯刻意回避了这些批判,留下了如何处理我们从无知之幕后获得的信息的问题。然而,或许更大的问题在于,如何首先收集这些信息。
Rawls’s philosophical critics have argued at length about how exactly we are supposed to leverage the information obtained from the veil of ignorance. Should we be trying, for instance, to maximize mean happiness, median happiness, total happiness, or something else? Each of these approaches, famously, leaves itself open to pernicious dystopias—such as the civilization of Omelas imagined by writer Ursula K. Le Guin, in which prosperity and harmony abound but a single child is forced to live in abject misery. These are worthy critiques, and Rawls deliberately sidesteps them by leaving open the question of what to do with the information we get from behind the veil. Perhaps the bigger question, though, is how to gather that information in the first place.
答案很可能来自计算机科学。麻省理工学院的斯科特·阿伦森表示,他很惊讶计算机科学家尚未对哲学产生更大的影响。他怀疑,部分原因在于他们“未能传达出他们能够为哲学的概念库增添什么”。他进一步阐述道:
The answer may well come from computer science. MIT’s Scott Aaronson says he’s surprised that computer scientists haven’t yet had more influence on philosophy. Part of the reason, he suspects, is just their “failure to communicate what they can add to philosophy’s conceptual arsenal.” He elaborates:
人们可能会认为,一旦我们知道某件事是可计算的,那么计算它需要 10 秒还是 20 秒显然是工程师而不是哲学家关心的问题。但如果问题是 10 秒还是 10 1010秒的问题,那么这个结论就不会那么明显了!事实上,在复杂性理论中,我们关心的量变差距通常非常大,以至于人们也必须将它们视为质变差距。例如,想想读一本 400 页的书和读完每一本这样的书之间的区别,或者写下一个千位数字和数到这个数字之间的区别。
One might think that, once we know something is computable, whether it takes 10 seconds or 20 seconds to compute is obviously the concern of engineers rather than philosophers. But that conclusion would not be so obvious, if the question were one of 10 seconds versus 101010 seconds! And indeed, in complexity theory, the quantitative gaps we care about are usually so vast that one has to consider them qualitative gaps as well. Think, for example, of the difference between reading a 400-page book and reading every possible such book, or between writing down a thousand-digit number and counting to that number.
计算机科学为我们提供了一种方法来阐明评估所有可能的社会保障措施(例如,针对胫骨受伤的情况)的复杂性。但幸运的是,它也提供了处理这种复杂性的工具。而基于采样的蒙特卡洛算法正是其中最有用的方法之一。
Computer science gives us a way to articulate the complexity of evaluating all possible social provisions for something like an injured shin. But fortunately, it also provides tools for dealing with that complexity. And the sampling-based Monte Carlo algorithms are some of the most useful approaches in that toolbox.
例如,当我们需要理解国家医疗改革——一个复杂得难以理解的庞大体系——时,我们的政治领导人通常会提供两样东西:精心挑选的个人轶事和汇总的统计数据。当然,这些轶事丰富生动,但却缺乏代表性。几乎任何一项立法,无论多么开明或误导,都会使一些人境况变好,而另一些人境况变坏,因此精心挑选的故事无法提供任何关于更广泛模式的视角。另一方面,汇总统计数据则相反:全面但单薄。例如,我们或许能了解全国范围内的平均保费是否下降,但无法了解这种变化在更细微的层面上是如何体现的:大多数人的保费可能会下降,但像奥米拉那样,某些特定群体——本科生、阿拉斯加人或孕妇——却陷入了困境。统计数据只能告诉我们故事的一部分,掩盖了任何潜在的异质性。而且我们常常甚至不知道我们需要哪个统计数据。
When we need to make sense of, say, national health care reform—a vast apparatus too complex to be readily understood—our political leaders typically offer us two things: cherry-picked personal anecdotes and aggregate summary statistics. The anecdotes, of course, are rich and vivid, but they’re unrepresentative. Almost any piece of legislation, no matter how enlightened or misguided, will leave someone better off and someone worse off, so carefully selected stories don’t offer any perspective on broader patterns. Aggregate statistics, on the other hand, are the reverse: comprehensive but thin. We might learn, for instance, whether average premiums fell nationwide, but not how that change works out on a more granular level: they might go down for most but, Omelas-style, leave some specific group—undergraduates, or Alaskans, or pregnant women—in dire straits. A statistic can only tell us part of the story, obscuring any underlying heterogeneity. And often we don’t even know which statistic we need.
由于全面的统计数据和政客们津津乐道的故事都无法真正引导我们理解数千页的立法提案,一位精通蒙特卡罗计算的计算机科学家会提出一种不同的方法:抽样。仔细检查随机样本可能是理解那些过于复杂而无法直接理解的问题的最有效方法之一。当涉及到处理难以定性处理的问题,即那些棘手复杂、无法被完整消化的问题——例如单人纸牌游戏或原子裂变、素数测试或公共政策——抽样提供了一种最简单、也是最佳的突破难题的方法之一。
Since neither sweeping statistics nor politicians’ favorite stories can truly guide us through thousands of pages of proposed legislation, a Monte Carlo–informed computer scientist would propose a different approach: sampling. A close examination of random samples can be one of the most effective means of making sense of something too complex to be comprehended directly. When it comes to handling a qualitatively unmanageable problem, something so thorny and complicated that it can’t be digested whole—solitaire or atomic fission, primality testing or public policy—sampling offers one of the simplest, and also the best, ways of cutting through the difficulties.
我们可以在慈善机构 GiveDirectly 身上看到这种做法的成效,该机构向肯尼亚和乌干达的极度贫困人口提供无条件现金补助。它因在多个层面上重新思考传统的慈善实践而备受关注:不仅在于其独特的使命,还在于其自身流程的透明度和问责制。而它对现状的最新挑战,正是其成功案例。
We can see this approach at work with the charity GiveDirectly, which distributes unconditional cash transfers to people living in extreme poverty in Kenya and Uganda. It has attracted attention for rethinking conventional charity practices on a number of levels: not only in its unusual mission, but in the level of transparency and accountability it brings to its own process. And the latest element of the status quo that it’s challenging is success stories.
“如果你经常浏览我们的网站、博客或Facebook页面,”项目助理丽贝卡·兰格写道,“你可能会注意到一些不常见的东西:我们受助人的故事和照片。”问题不在于其他慈善机构提供的那些光鲜亮丽的故事并非事实。而在于,这些故事是特意挑选出来用来展示成功案例的,这本身就让人难以判断究竟能从中获取多少信息。因此,GiveDirectly决定对这种传统做法进行一些调整。
“If you regularly check our website, blog, or Facebook page,” writes program assistant Rebecca Lange, “you may have noticed something you don’t often see: stories and photos of our recipients.” The problem isn’t that the glowing stories proffered by other charities aren’t true. Rather, the very fact that they were deliberately chosen to showcase successes makes it unclear how much information can be gleaned from them. So GiveDirectly decided to put a twist on this conventional practice as well.
每周三,GiveDirectly 团队都会随机选择一位现金受助人,派出一名实地工作人员进行采访,并逐字逐句地发布实地工作人员的记录,无论采访结果如何。例如,这是他们第一次采访的对象,采访对象是一位名叫玛丽的女士,她用这笔钱买了一个铁皮屋顶:*
Every Wednesday, the GiveDirectly team selects a cash recipient at random, sends out a field officer to interview them, and publishes the field officer’s notes verbatim, no matter what. For instance, here’s their first such interview, with a woman named Mary, who used the money for a tin roof:*
她建造了更好的房子,那就是铁皮屋。她还给自己买了一套沙发。她的生活发生了改变,因为以前她家的屋顶漏水,每逢下雨,屋里的所有水都会被吸干。但因为这次搬迁,她终于可以建造更好的铁皮屋了。
She was able to make a better house and that was a tinned house. She was also able to buy a sofa set for her own house. Her life has changed because she used to have a leaking roof soaking up everything in the house whenever it rained. But because of the transfer she was able to make a better tinned house.
“我们希望这能让你们对我们分享的所有类型的信息充满信心,”兰格写道,“甚至可能激励你们对其他组织提出更高的标准。”
“We hope that this gives you confidence in all types of information we share with you,” Lange writes, “and maybe even inspires you to hold other organizations to a higher bar.”
三部分权衡
The Three-Part Tradeoff
我立刻意识到,什么品质才能成就一位成就者,特别是在文学领域,而莎士比亚就拥有如此巨大的品质——我指的是消极能力,即当一个人能够置身于不确定、神秘和怀疑之中,而不会急躁地追求事实和理性时。
At once it struck me what quality went to form a Man of Achievement, especially in Literature, and which Shakespeare possessed so enormously—I mean Negative Capability, that is, when a man is capable of being in uncertainties, mysteries, doubts, without any irritable reaching after fact and reason.
—约翰·济慈
—JOHN KEATS
不存在绝对的确定性,但对于人类生活的目的而言,有足够的保证。
There is no such thing as absolute certainty, but there is assurance sufficient for the purposes of human life.
—约翰·斯图尔特·密尔
—JOHN STUART MILL
计算机科学常常是一个权衡利弊的问题。例如,在第三章关于排序的讨论中,我们注意到了前期排序所花费的时间与后期搜索所花费的时间之间的权衡。在第四章关于缓存的讨论中,我们探讨了占用额外空间(缓存换缓存再缓存)以节省时间的权衡。
Computer science is often a matter of negotiating tradeoffs. In our discussion of sorting in chapter 3, for instance, we noted the tradeoff between time spent up front on sorting versus the time spent later on searching. And in the discussion of caching in chapter 4, we explored the tradeoff of taking up extra space—caches for caches for caches—to save time.
时间和空间是计算机科学中最常见的权衡之道,但最近关于随机算法的研究表明,还有另一个变量需要考虑:确定性。正如哈佛大学的迈克尔·米岑马赫所说:“我们要做的是找到一个既能节省时间和空间,又能平衡第三个维度:错误概率的答案。” 当被问及他最喜欢的关于这种不确定性权衡的例子时,他毫不犹豫地说:“一位同事刚刚说,应该做一个喝酒游戏,每当我的幻灯片上出现这个词,你就得喝一杯。你听说过布隆过滤器吗?”
Time and space are at the root of the most familiar tradeoffs in computer science, but recent work on randomized algorithms shows that there’s also another variable to consider: certainty. As Harvard’s Michael Mitzenmacher puts it, “What we’re going to do is come up with an answer which saves you in time and space and trades off this third dimension: error probability.” Asked for his favorite example of this tradeoff into uncertainty, he doesn’t hesitate. “A colleague just said that there should be a drinking game that every time this term appears on one of my slides, you have to take a drink. Have you ever heard of Bloom filters?”
米茨恩马赫表示,要理解布隆过滤器背后的理念,不妨想象一下像谷歌这样的搜索引擎,它试图抓取整个网络并索引所有可能的URL。网络由超过一万亿个不同的URL组成,平均每个URL长度约为77个字符。当搜索引擎查看某个URL时,它如何检查该页面是否已被处理?仅仅存储所有已访问URL的列表就会占用大量空间,而反复搜索该列表(即使列表已完全排序)可能是一场噩梦。事实上,治疗可能比疾病本身更糟糕:换句话说,每次检查以确保我们没有重新索引某个页面可能比仅仅索引两次偶尔的页面更耗时。
To understand the idea behind a Bloom filter, Mitzenmacher says, consider a search engine like Google, trying to crawl the entire web and index every possible URL. The web is comprised of well over a trillion distinct URLs, and the average URL weighs in at about seventy-seven characters long. When the search engine looks at some URL, how can it check whether that page has already been processed? Just storing a list of all the URLs that have been visited would take a huge amount of space, and repeatedly searching that list (even if it were fully sorted) could prove a nightmare. In fact, it could well be that the cure is worse than the disease: in other words, checking every time to make sure that we’re not reindexing a page might be more time-consuming than just indexing the occasional page twice.
但是,如果我们只需要基本确定这个 URL 对我们来说是新的呢?这时就需要用到布隆过滤器了。布隆过滤器以其发明者伯顿·H·布隆 (Burton H. Bloom) 的名字命名,其工作原理与拉宾-米勒素数测试非常相似:将 URL 输入一组方程式,这些方程式本质上是检查其新颖性的“证据”。(这些方程式不是宣称“ n不是素数”,而是说“我以前没见过n ”。)如果您愿意容忍 1% 或 2% 的错误率,那么将发现存储在像布隆过滤器这样的概率数据结构中将为您节省大量时间和空间。而且,此类过滤器的用途不仅限于搜索引擎:许多最新的 Web 浏览器都附带了布隆过滤器,用于根据已知恶意网站列表检查 URL,它们也是比特币等加密货币的重要组成部分。
But what if we only needed to be mostly sure this URL was new to us? That’s where the Bloom filter comes in. Named for its inventor, Burton H. Bloom, a Bloom filter works much like the Rabin-Miller primality test: the URL is entered into a set of equations that esssentially check for “witnesses” to its novelty. (Rather than proclaim “n is not prime,” these equations say “I have not seen n before.”) If you’re willing to tolerate an error rate of just 1% or 2%, storing your findings in a probabilistic data structure like a Bloom filter will save you significant amounts of both time and space. And the usefulness of such filters is not confined to search engines: Bloom filters have shipped with a number of recent web browsers to check URLs against a list of known malicious websites, and they are also an important part of cryptocurrencies like Bitcoin.
米岑马赫说:“我认为,问题在于人们没有把误差权衡空间的概念与计算联系起来。他们认为计算机应该给出答案。所以,当你在算法课上听到‘它应该给你一个答案;但这可能不是正确答案’时,我认为当(学生们)听到这句话时,他们会集中注意力。我认为人们在自己的生活中并没有意识到自己有多少次这样做,也没有接受过这种做法。”
Says Mitzenmacher, “The idea of the error tradeoff space—I think the issue is that people don’t associate that with computing. They think computers are supposed to give you the answer. So when you hear in your algorithms class, ‘It’s supposed to give you one answer; it might not be the right answer’—I like to think that when [students] hear that, it focuses them. I think people don’t realize in their own lives how much they do that and accept that.”
山丘、山谷和陷阱
Hills, Valleys, and Traps
河流蜿蜒流淌,因为它无法思考。
The river meanders because it can’t think.
—理查德·肯尼
—RICHARD KENNEY
随机性也已被证明是解决离散优化问题的有力武器,例如编制NCAA篮球赛程,或为旅行商寻找最短路线。在上一章中,我们了解了松弛法在缩小此类问题规模方面发挥的重要作用,但随机性的巧妙运用无疑已成为一项更为重要的技巧。
Randomness has also proven itself to be a powerful weapon for solving discrete optimization problems, like assembling the calendar for NCAA basketball or finding the shortest route for a traveling salesman. In the previous chapter we saw how relaxation can play a big role in cutting such problems down to size, but the tactical use of randomness has emerged as an arguably even more important technique.
想象一下,你正在计划一次环球旅行,行程涵盖十个城市,这相当于你自己版本的旅行商问题:你的出发地和终点都是旧金山,之后你将游览西雅图、洛杉矶、纽约、布宜诺斯艾利斯、伦敦、阿姆斯特丹、哥本哈根、伊斯坦布尔、德里和京都。你可能不会太在意行程的总长度,但你肯定想尽量减少旅行的费用。首先要注意的是,虽然十个城市听起来不多,但可能的行程数量却是十的阶乘:超过三百五十万种。换句话说,你不可能简单地检查所有排列组合,然后选出最低的价格。你必须更聪明地思考。
Imagine you’re putting together a globe-trotting ten-city vacation, your own version of the traveling salesman problem: you’ll start and finish in San Francisco and visit Seattle, Los Angeles, New York, Buenos Aires, London, Amsterdam, Copenhagen, Istanbul, Delhi, and Kyoto. You might not be too worried about the total length of the route, but you probably do want to minimize the monetary cost of the trip. The first thing to note here is that even though ten cities hardly sounds like a lot, the number of possible itineraries is ten factorial: more than three and a half million. In other words, there’s no practical way for you to simply check every permutation and pick the lowest price. You have to work smarter than that.
在你第一次尝试制定行程时,你可能会考虑乘坐最便宜的航班从旧金山出发(假设是西雅图),然后从那里乘坐最便宜的航班飞往其他任何城市(假设是洛杉矶),然后从那里乘坐最便宜的航班(假设是纽约),依此类推,直到你到达第十个城市,然后从那里飞回旧金山。这是一个所谓贪婪算法的例子,你也可以把它看作是一种“短视算法”:一种目光短浅、在每一步都选择最好的东西的算法。在调度理论中,正如我们在第 5 章中看到的那样,贪婪算法——例如,总是做最短的工作,而不考虑或规划更远——有时可能就是解决问题所需要的全部。在这种情况下,对于旅行商问题,贪婪算法给出的解决方案可能并不糟糕,但它可能远非你能做到的最好。
For your first attempt at an itinerary, you might look at taking the cheapest flight out of San Francisco (let’s say it’s Seattle), then taking the cheapest flight from there to any of the other remaining cities (call it Los Angeles), then the cheapest from there (say, New York), and so forth, until you’re at your tenth city and you fly from there back to San Francisco. This is an example of a so-called greedy algorithm, which you can also think of as a “myopic algorithm”: one that shortsightedly takes the best thing available every step of the way. In scheduling theory, as we saw in chapter 5, a greedy algorithm—for instance, always doing the shortest job available, without looking or planning beyond—can sometimes be all that a problem requires. In this case, for the traveling salesman problem, the solution given by the greedy algorithm probably isn’t terrible, but it’s likely to be far from the best you can do.
制定好基准行程后,您可以通过对城市顺序进行细微调整来测试一些替代方案,看看是否能有所改进。例如,如果我们先去西雅图,然后去洛杉矶,我们可以尝试以相反的顺序游览这两个城市:先去洛杉矶,然后去西雅图。对于任何给定的行程,我们可以进行 11 次这样的两城互换;假设我们尝试了所有行程,然后选择最省钱的那个。从现在开始,我们有了一个新的行程,我们可以开始对这个行程进行排列组合,再次寻找最佳的局部改进。这种算法称为爬山法——因为在解决方案空间(有好有坏)中进行搜索的过程通常被认为是有丘陵和山谷的景观,而您的目标是到达最高峰。
Once you’ve assembled a baseline itinerary, you might test some alternatives by making slight perturbations to the city sequence and seeing if that makes an improvement. For instance, if we are going first to Seattle, then to Los Angeles, we can try doing those cities in reverse order: L.A. first, then Seattle. For any given itinerary, we can make eleven such two-city flip-flops; let’s say we try them all and then go with the one that gives us the best savings. From here we’ve got a new itinerary to work with, and we can start permuting that one, again looking for the best local improvement. This is an algorithm known as Hill Climbing—since the search through a space of solutions, some better and some worse, is commonly thought of in terms of a landscape with hills and valleys, where your goal is to reach the highest peak.
最终,你会得到一个比所有排列组合都更好的解决方案;无论你翻转哪个相邻的站点,都没有什么能比得上它。爬山之旅就此停止。但这是否意味着你已经找到了最佳的路线?很遗憾,不是。你可能只找到了所谓的“局部最大值”,而不是所有可能性的全局最大值。爬山的风景雾蒙蒙的。你可以知道自己正站在山顶,因为地面向四面八方延伸——但也许在下一个山谷对面,有一座更高的山,隐藏在云层之后。
Eventually you will end up with a solution that is better than all of its permutations; no matter which adjacent stops you flip, nothing beats it. It’s here that the hill climbing stops. Does this mean you’ve definitely found the single best possible itinerary, though? Sadly, no. You may have found only a so-called “local maximum,” not the global maximum of all the possibilities. The hill-climbing landscape is a misty one. You can know that you’re standing on a mountaintop because the ground falls away in all directions—but there might be a higher mountain just across the next valley, hidden behind clouds.
“错误景观”描述了解决方案质量在不同可能性下如何变化。
An “error landscape,” which depicts how solution quality can vary across different possibilities.
想象一下困在笼子里的龙虾:可怜的家伙,它没有意识到离开笼子意味着要回到笼子的中心,它需要深入笼子才能出来。龙虾笼只不过是用铁丝做成的局部最大值——一个致命的局部最大值。
Consider the lobster stuck in the lobster trap: poor beast, he doesn’t realize that exiting the cage means backtracking to the cage’s center, that he needs to go deeper into the cage to make it out. A lobster trap is nothing other than a local maximum made of wire—a local maximum that kills.
在假期规划中,幸运的是,局部最优解的致命性没那么强,但它们也具有同样的特性。即使我们找到了一个无法通过任何细微调整来改进的解决方案,我们仍然可能错失全局最优解。真正的最佳行程可能需要对整个行程进行彻底的调整:例如,以不同的顺序游览整个大陆,或者向西而不是向东行进。如果我们想继续寻求改进,可能需要暂时降低解决方案的难度。而随机性恰恰提供了一种策略——实际上是几种策略——来实现这一点。
In the case of vacation planning, local maxima are fortunately less fatal, but they have the same character. Even once we’ve found a solution that can’t be improved by any small tweaks, it’s possible that we are still missing the global maximum. The true best itinerary may require a radical overhaul of the trip: doing entire continents in a different order, for instance, or proceeding westward instead of eastward. We may need to temporarily worsen our solution if we want to continue searching for improvements. And randomness provides a strategy—actually, several strategies—for doing just that.
超出局部最大值
Out of the Local Maximum
一种方法是在“爬山法”的基础上,加入所谓的“抖动”:如果感觉自己卡住了,就稍微调整一下。随机做一些小的调整(即使这些调整会变得更糟),然后再回到“爬山法”;看看你最终能否到达更高的顶峰。
One approach is to augment Hill Climbing with what’s known as “jitter”: if it looks like you’re stuck, mix things up a little. Make a few random small changes (even if they are for the worse), then go back to Hill Climbing; see if you end up at a higher peak.
另一种方法是,当我们达到局部最大值时,彻底打乱我们的解,然后从这个随机的新起点重新开始爬山算法。这种算法被恰当地称为“随机重启爬山算法”,或者更贴切地称为“散弹枪爬山算法”。当问题中存在大量局部最大值时,这种策略非常有效。例如,计算机科学家在尝试解密代码时会使用这种方法,因为有很多方法可以解密一条消息,这些方法起初看起来很有希望,但最终却走进了死胡同。在解密过程中,拥有一段看起来接近合理英语的文本并不一定意味着你已经走在正确的轨道上。所以有时候最好不要太执着于最初看起来有希望的方向,而是从头开始。
Another approach is to completely scramble our solution when we reach a local maximum, and start Hill Climbing anew from this random new starting point. This algorithm is known, appropriately enough, as “Random-Restart Hill Climbing”—or, more colorfully, as “Shotgun Hill Climbing.” It’s a strategy that proves very effective when there are lots of local maxima in a problem. For example, computer scientists use this approach when trying to decipher codes, since there are lots of ways to begin decrypting a message that look promising at first but end up being dead ends. In decryption, having a text that looks somewhat close to sensible English doesn’t necessarily mean that you’re even on the right track. So sometimes it’s best not to get too attached to an initial direction that shows promise, and simply start over from scratch.
但还有第三种方法:与其在遇到瓶颈时完全依赖随机性,不如在每次做决定时都使用一点随机性。这项技术由发明蒙特卡洛方法的洛斯阿拉莫斯团队开发,被称为“ Metropolis 算法”。Metropolis 算法类似于爬山法,会尝试对解决方案进行不同的小规模调整,但有一个重要的区别:在任何给定点,它都可能接受不好的调整,也可能接受好的调整。
But there’s also a third approach: instead of turning to full-bore randomness when you’re stuck, use a little bit of randomness every time you make a decision. This technique, developed by the same Los Alamos team that came up with the Monte Carlo Method, is called the Metropolis Algorithm. The Metropolis Algorithm is like Hill Climbing, trying out different small-scale tweaks on a solution, but with one important difference: at any given point, it will potentially accept bad tweaks as well as good ones.
我们可以想象一下将其应用到我们的假期规划问题中。同样,我们尝试通过调整不同城市的位置来调整我们提出的解决方案。如果随机生成的旅行路线调整带来了改进,那么我们始终会接受它,并在此基础上继续调整。但如果这种调整会使情况变得更糟,我们仍然有机会继续进行(尽管调整越糟糕,机会越小)。这样,我们就不会长时间陷入局部最大值:最终,我们会尝试另一个附近的解决方案,即使它的成本更高,并且有可能最终找到一个新的、更好的计划。
We can imagine applying this to our vacation planning problem. Again, we try to tweak our proposed solution by jiggling around the positions of different cities. If a randomly generated tweak to our travel route results in an improvement, then we always accept it, and continue tweaking from there. But if the alteration would make thing a little worse, there’s still a chance that we go with it anyway (although the worse the alteration is, the smaller the chance). That way, we won’t get stuck in any local maximum for very long: eventually we’ll try another nearby solution, even though it’s more expensive, and potentially be on our way to coming up with a new and better plan.
无论是抖动、随机重启,还是偶尔出现恶化,随机性对于避免局部最大值都极其有用。随机性不仅是处理棘手优化问题的一种可行方法;在很多情况下,它至关重要。然而,一些问题依然存在。你应该使用多少随机性?什么时候使用?而且——考虑到像Metropolis算法这样的策略几乎可以无限地改变我们的行程——你怎么知道你已经完成了?对于致力于优化的研究人员来说,这些问题的一个令人惊讶的明确答案可能来自另一个完全不同的领域。
Whether it’s jitter, random restarts, or being open to occasional worsening, randomness is incredibly useful for avoiding local maxima. Chance is not just a viable way of dealing with tough optimization problems; in many cases, it’s essential. Some questions linger, however. How much randomness should you use? And when? And—given that strategies such as the Metropolis Algorithm can permute our itinerary pretty much ad infinitum—how do you ever know that you’re done? For researchers working on optimization, a surprisingly definitive answer to these questions would come from another field entirely.
模拟退火
Simulated Annealing
20 世纪 70 年代末 80 年代初,斯科特·柯克帕特里克 (Scott Kirkpatrick) 认为自己是物理学家,而不是计算机科学家。柯克帕特里克尤其对统计物理学感兴趣,该学科利用随机性来解释某些自然现象——例如退火物理学,即材料在加热和冷却过程中状态的变化。退火最有趣的特性或许在于,材料冷却的速度往往会对其最终结构产生巨大影响。正如柯克帕特里克所解释的那样:
In the late 1970s and early ’80s, Scott Kirkpatrick considered himself a physicist, not a computer scientist. In particular, Kirkpatrick was interested in statistical physics, which uses randomness as a way to explain certain natural phenomena—for instance, the physics of annealing, the way that materials change state as they are heated and cooled. Perhaps the most interesting characteristic of annealing is that how quickly or slowly a material is cooled tends to have tremendous impact on its final structure. As Kirkpatrick explains:
从熔体中生长单晶需要经过仔细的退火处理,首先将物质熔化,然后缓慢降低温度,并在接近凝固点的温度下保持较长时间。如果不进行退火处理,导致物质失去平衡,则生成的晶体将存在许多缺陷,或者可能形成无晶体有序性的玻璃。
Growing a single crystal from a melt [is] done by careful annealing, first melting the substance, then lowering the temperature slowly, and spending a long time at temperatures in the vicinity of the freezing point. If this is not done, and the substance is allowed to get out of equilibrium, the resulting crystal will have many defects, or the substance may form a glass, with no crystalline order.
柯克帕特里克当时在 IBM 工作,当时面临的最大、最棘手、最神圣的问题之一是如何布局 IBM 生产的芯片上的电路。这个问题既笨拙又棘手:需要考虑的解决方案种类繁多,而且还有一些棘手的限制条件。例如,通常情况下,组件之间最好靠近一些,但也不能太近,否则就没有空间布线。而且,每次移动任何东西,都必须重新计算所有电线在新的假设布局中的走线方式。
Kirkpatrick was then working at IBM, where one of the biggest, trickiest, and most hallowed problems was how to lay out the circuits on the chips that IBM was manufacturing. The problem was ungainly and intractable: there was an enormous range of possible solutions to consider, and some tricky constraints. It was better in general for the components to be close together, for instance—but not too close, or there would be no room for the wires. And any time you moved anything, you’d have to recompute how all the wires would run in the new hypothetical layout.
当时,这个过程是由 IBM 内部一位神秘的大师级人物主导的。正如柯克帕特里克回忆的那样:“这位 IBM 最擅长在芯片上塞入更多电路的人……却用一种极其神秘的方式解释自己在做什么。他不喜欢真正地告诉你。”
At the time, this process was led by something of a cryptic guru-type figure within IBM. As Kirkpatrick recalls, “The guy who was the best at IBM at squeezing more circuits on a chip … he had the most mysterious way of explaining what he was doing. He didn’t like to really tell you.”
柯克帕特里克的朋友兼 IBM 同事丹·盖拉特 (Dan Gelatt) 对这个问题非常着迷,并很快吸引了柯克帕特里克的注意,后者灵光一闪。“研究(物理系统)的方法是先加热,然后冷却,让系统自行组织。从这个角度来看,把所有类型的优化问题都看作是试图组织的自由度,就像小原子、自旋或其他什么东西一样,似乎是再自然不过的事情了。”
Kirkpatrick’s friend and IBM colleague Dan Gelatt was fascinated by the problem, and quickly hooked Kirkpatrick, who had a flash of insight. “The way to study [physical systems] was to warm them up then cool them down, and let the system organize itself. From that background, it seemed like a perfectly natural thing to treat all kinds of optimization problems as if the degrees of freedom that you were trying to organize were little atoms, or spins, or what have you.”
在物理学中,我们所说的“温度”实际上指的是速度——分子尺度上的随机运动。柯克帕特里克推断,这与爬山算法中添加的随机抖动非常类似,这种抖动有时会使算法从较好的解回溯到较差的解。事实上,Metropolis 算法本身最初的设计初衷就是模拟物理系统中的随机行为(在 Metropolis 算法中,指的是核爆炸)。那么,柯克帕特里克想知道,如果将优化问题视为退火问题——先“加热”,然后慢慢“冷却”,会发生什么?
In physics, what we call “temperature” is really velocity—random motion at the molecular scale. This was directly analogous, Kirkpatrick reasoned, to the random jitter that can be added to a hill-climbing algorithm to make it sometimes backtrack from better solutions to worse ones. In fact, the Metropolis Algorithm itself had initially been designed to model random behavior in physical systems (in that case, nuclear explosions). So what would happen, Kirkpatrick wondered, if you treated an optimization problem like an annealing problem—if you “heated it up” and then slowly “cooled it off”?
以上面的十个城市的度假问题为例,我们可以从“高温”开始,完全随机地选择我们的起始行程,从整个可能的解决方案空间中挑选一个,而不考虑价格。然后,每当我们考虑调整城市序列时,我们就可以开始慢慢地“冷却”我们的搜索,通过掷骰子。选择更优的变体总是有意义的,但是只有当骰子显示 2 或更大时,我们才会选择较差的变体。过了一会儿,我们会进一步冷却,只有当骰子显示 3 或更大时才采用更高价格的变化——然后是 4,然后是 5。最终,我们将主要进行爬坡移动,当骰子显示 6 时偶尔进行较差的移动。最后,我们开始只上坡,并在达到下一个局部最大值时停止。
Taking the ten-city vacation problem from above, we could start at a “high temperature” by picking our starting itinerary entirely at random, plucking one out of the whole space of possible solutions regardless of price. Then we can start to slowly “cool down” our search by rolling a die whenever we are considering a tweak to the city sequence. Taking a superior variation always makes sense, but we would only take inferior ones when the die shows, say, a 2 or more. After a while, we’d cool it further by only taking a higher-price change if the die shows a 3 or greater—then 4, then 5. Eventually we’d be mostly hill climbing, making the inferior move just occasionally when the die shows a 6. Finally we’d start going only uphill, and stop when we reached the next local max.
这种名为“模拟退火”的方法,看似是一种将物理学映射到问题求解上的有趣方法。但它真的有效吗?传统优化研究人员最初的反应是,这整个方法似乎有点……太过隐喻了。“我无法让数学家们相信,这些像温度这样杂乱无章的东西,所有这些基于类比的东西,是真实存在的,”柯克帕特里克说,“因为数学家们被训练得非常不相信直觉。”
This approach, called Simulated Annealing, seemed like an intriguing way to map physics onto problem solving. But would it work? The initial reaction among more traditional optimization researchers was that this whole approach just seemed a little too … metaphorical. “I couldn’t convince math people that this messy stuff with temperatures, all this analogy-based stuff, was real,” says Kirkpatrick, “because mathematicians are trained to really distrust intuition.”
但对这种基于类比方法的任何怀疑很快就会消失:在IBM,柯克帕特里克和盖拉特的模拟退火算法开始做出比大师们更好的芯片布局。他们没有对自己的秘密武器保持沉默,自己也成为神秘的大师级人物,而是在《科学》杂志上发表了一篇论文,向其他人开放了他们的方法。在接下来的几十年里,这篇论文被引用了高达三万两千次。时至今日,模拟退火仍然是该领域已知的解决优化问题最有前景的方法之一。
But any distrust regarding the analogy-based approach would soon vanish: at IBM, Kirkpatrick and Gelatt’s simulated annealing algorithms started making better chip layouts than the guru. Rather than keep mum about their secret weapon and become cryptic guru figures themselves, they published their method in a paper in Science, opening it up to others. Over the next few decades, that paper would be cited a whopping thirty-two thousand times. To this day, simulated annealing remains one of the most promising approaches to optimization problems known to the field.
随机性、进化和创造力
Randomness, Evolution, and Creativity
1943年,萨尔瓦多·卢里亚(Salvador Luria)并不知道自己即将做出一项可能赢得诺贝尔奖的发现;他以为自己只是去参加一场舞会。卢里亚刚从墨索里尼统治下的意大利移民到美国,他的塞法迪犹太家庭曾居住在那里。他是一名研究员,研究细菌如何对病毒产生免疫力。但此时,他正忙于研究,参加在印第安纳大学附近一个乡村俱乐部举行的教职工聚会。
In 1943, Salvador Luria didn’t know he was about to make a discovery that would lead to a Nobel Prize; he thought he was going to a dance. A recent immigrant to the United States from Mussolini’s Italy, where his Sephardic Jewish family had lived, Luria was a researcher studying how bacteria developed immunity from viruses. But at this moment his research was far from his mind, as he attended a faculty gathering at a country club near Indiana University.
卢里亚正在观看他的一位同事玩老虎机:
Luria was watching one of his colleagues play a slot machine:
我自己不是赌徒,当时我正拿他那不可避免的输钱来调侃他,结果他突然中了头奖,大概是三美元一角硬币,狠狠地瞪了我一眼,就走开了。就在那时,我开始思考老虎机的真正命理学;思考的过程中,我突然意识到,老虎机和细菌突变之间确实存在着一些可以互相借鉴的东西。
Not a gambler myself, I was teasing him about his inevitable losses, when he suddenly hit the jackpot, about three dollars in dimes, gave me a dirty look, and walked away. Right then I began giving some thought to the actual numerology of slot machines; in doing so it dawned on me that slot machines and bacterial mutations have something to teach each other.
20 世纪 40 年代,人们尚不清楚细菌对病毒(以及抗生素)产生耐药性的具体原因和方式。它们是细菌内部对病毒的反应,还是仅仅是持续的突变偶尔意外产生耐药性?似乎没有办法设计一个实验来给出决定性的答案——直到卢里亚看到那台老虎机,他恍然大悟。卢里亚意识到,如果他培育几代不同谱系的细菌,然后将最后一代暴露于病毒,将会发生两种截然不同的情况之一。如果耐药性是对病毒的反应,那么他预计在他的每一种细菌培养物中都会出现大致相同数量的耐药细菌,无论它们的谱系如何。另一方面,如果耐药性来自偶然突变,他预计会看到更加不平衡的情况——就像老虎机的赔率一样。也就是说,大多数谱系的细菌根本不会表现出耐药性;有些血统会有一个“孙辈”文化发生突变,变得具有抗性;在极少数情况下,如果在“家谱”上几代都发生了正确的突变,就会出现一个意外的惊喜:该血统中的所有“孙辈”都会具有抗性。卢里亚尽快离开了这场“舞蹈”,并开始了实验。
In the 1940s, it wasn’t known exactly why or how bacterial resistance to viruses (and, for that matter, to antibiotics) came about. Were they reactions within the bacteria to the virus, or were there simply ongoing mutations that occasionally produced resistance by accident? There seemed no way to devise an experiment that would offer a decisive answer one way or the other—that is, until Luria saw that slot machine and something clicked. Luria realized that if he bred several generations of different lineages of bacteria, then exposed the last generation to a virus, one of two radically different things would happen. If resistance was a response to the virus, he’d expect roughly the same amount of resistant bacteria to appear in every one of his bacterial cultures, regardless of their lineage. On the other hand, if resistance emerged from chance mutations, he’d expect to see something a lot more uneven—just like a slot machine’s payouts. That is, bacteria from most lineages would show no resistance at all; some lineages would have a single “grandchild” culture that had mutated to become resistant; and on rare occasions, if the proper mutation had happened several generations up the “family tree,” there would be a jackpot: all the “grandchildren” in the lineage would be resistant. Luria left the dance as soon as he could and set the experiment in motion.
经过几天紧张焦躁的等待,卢里亚回到实验室检查他的菌落。中奖了。
After several days of tense, restless waiting, Luria returned to the lab to check on his colonies. Jackpot.
卢里亚的发现关乎机遇的力量:随机、偶然的突变如何产生病毒耐药性。但这也至少在一定程度上归功于 机遇的力量。他在正确的时间出现在正确的地点,看到老虎机后激发了一个新的想法。发现的故事常常以类似的时刻为特色:牛顿的苹果(可能是杜撰的)、阿基米德的浴缸“尤里卡!”、被忽视的培养皿,那里生长着青霉菌。事实上,这是一种相当普遍的现象,甚至有人发明了一个词来形容它:1754年,霍勒斯·沃波尔创造了“serendipity”(意外发现)一词,取材于塞伦迪普三王子(塞伦迪普是斯里兰卡的古称)的童话冒险故事,他们“总是凭借偶然和智慧,发现他们并非追寻的事物”。
Luria’s discovery was about the power of chance: about how random, haphazard mutations can produce viral resistance. But it was also, at least in part, due to the power of chance. He was in the right place at the right time, where seeing the slot machine triggered a new idea. Tales of discovery often feature a similar moment: Newton’s (possibly apocryphal) apple, Archimedes’ bathtub “Eureka!,” the neglected petri dish that grew Penicillium mold. Indeed, it’s a common enough phenomenon that a word was invented to capture it: in 1754, Horace Walpole coined the term “serendipity,” based on the fairy tale adventures of The Three Princes of Serendip (Serendip being the archaic name of Sri Lanka), who “were always making discoveries, by accidents and sagacity, of things they were not in quest of.”
随机性的双重作用——既是生物学的关键部分,也是发现的关键部分——屡屡引起那些想要解释人类创造力的心理学家的关注。威廉·詹姆斯(William James)提出了这一观点的早期例子。1880年,詹姆斯刚刚被任命为哈佛大学心理学助理教授,距离他权威著作《心理学原理》的出版还有十年,他在《大西洋月刊》上发表了一篇题为《伟人、伟大思想与环境》的文章。文章开篇即提出他的论点:
This double role of randomness—a key part of biology, a key part of discovery—has repeatedly caught the eye of psychologists who want to explain human creativity. An early instance of this idea was offered by William James. In 1880, having recently been appointed assistant professor of psychology at Harvard, and ten years away from publishing his definitive Principles of Psychology, James wrote an article in the Atlantic Monthly called “Great Men, Great Thoughts, and the Environment.” The article opens with his thesis:
据我所知,社会进化和人类智力成长的事实与达尔文先生所阐述的动物进化的事实之间存在着惊人的相似之处,但这种相似之处从未被注意到。
A remarkable parallel, which to my knowledge has never been noticed, obtains between the facts of social evolution and the mental growth of the race, on the one hand, and of zoölogical evolution, as expounded by Mr. Darwin, on the other.
詹姆斯写作时,“动物进化”的概念尚且鲜活—— 《物种起源》于1859年出版,达尔文先生本人也健在。詹姆斯探讨了进化论的思想如何应用于人类社会的不同方面,并在文章结尾转向了思想的进化:
At the time James was writing, the idea of “zoölogical evolution” was still fresh—On the Origin of Species having been published in 1859 and Mr. Darwin himself still alive. James discussed how evolutionary ideas might be applied to different aspects of human society, and toward the end of the article turned to the evolution of ideas:
新概念、情感和积极倾向的演变最初都是以随机图像、幻想和极不稳定的人类大脑功能活动中自发变异的偶然产物的形式产生的,外部环境只是证实或反驳、采纳或拒绝、保留或摧毁——简而言之,选择,就像它选择由于类似的分子事故而导致的形态和社会变异一样。
New conceptions, emotions, and active tendencies which evolve are originally produced in the shape of random images, fancies, accidental out-births of spontaneous variation in the functional activity of the excessively unstable human brain, which the outer environment simply confirms or refutes, adopts or rejects, preserves or destroys—selects, in short, just as it selects morphological and social variations due to molecular accidents of an analogous sort.
因此,詹姆斯将随机性视为创造力的核心。他相信,这种随机性在最具创造力的人身上被放大了。他写道,在他们面前,“我们仿佛突然置身于一个沸腾的思想熔炉中,一切都在令人眼花缭乱的活动中沸腾翻滚,合作关系可能瞬间建立或瓦解,单调乏味的常规已成定局,而意外似乎成了唯一的法则。”(请注意,这里同样的“退火”直觉,根植于温度的隐喻,其中疯狂的排列组合等同于热量。)
James thus viewed randomness as the heart of creativity. And he believed it was magnified in the most creative people. In their presence, he wrote, “we seem suddenly introduced into a seething caldron of ideas, where everything is fizzling and bobbing about in a state of bewildering activity, where partnerships can be joined or loosened in an instant, treadmill routine is unknown, and the unexpected seems the only law.” (Note here the same “annealing” intuition, rooted in metaphors of temperature, where wild permutation equals heat.)
詹姆斯理论的现代实例出现在唐纳德·坎贝尔(Donald Campbell)的著作中,坎贝尔是一位比他晚一百年的心理学家。1960年,坎贝尔发表了一篇题为《创造性思维中的盲目变异和选择性保留》(Blind Variation and Selective Retention in Creative Thought as in Other Knowledge Processes)的论文。与詹姆斯一样,他以自己的核心论点开篇:“盲目变异和选择性保留过程是所有归纳性成就、所有真正的知识增长以及所有系统与环境契合度提升的基础。” 他也像詹姆斯一样受到进化论的启发,认为创造性创新是新想法随机产生,而敏锐的人类思维会保留其中精华的结果。坎贝尔大量引用其他科学家和数学家关于他们自身发现背后过程的论述来支持自己的论点。 19 世纪的物理学家和哲学家恩斯特·马赫和亨利·庞加莱似乎都提出了与坎贝尔类似的解释,马赫甚至宣称“这可以解释牛顿、莫扎特、理查德·瓦格纳等人的言论,他们说思想、旋律与和声涌入他们的脑海,而他们只是保留了正确的部分。”
The modern instantiation of James’s theory appears in the work of Donald Campbell, a psychologist who lived a hundred years later. In 1960, Campbell published a paper called “Blind Variation and Selective Retention in Creative Thought as in Other Knowledge Processes.” Like James, he opened with his central thesis: “A blind-variation-and-selective-retention process is fundamental to all inductive achievements, to all genuine increases in knowledge, to all increases in fit of system to environment.” And like James he was inspired by evolution, thinking about creative innovation as the outcome of new ideas being generated randomly and astute human minds retaining the best of those ideas. Campbell supported his argument liberally with quotes from other scientists and mathematicians about the processes behind their own discoveries. The nineteenth-century physicists and philosophers Ernst Mach and Henri Poincaré both seemed to offer an account similar to Campbell’s, with Mach going so far as to declare that “thus are to be explained the statements of Newton, Mozart, Richard Wagner, and others, when they say that thought, melodies, and harmonies had poured in upon them, and that they had simply retained the right ones.”
说到激发创造力,一种常见的技巧是引入随机元素,比如一个人们必须与之建立联想的词语。例如,音乐家布莱恩·伊诺和艺术家彼得·施密特创造了一副名为“斜向策略”的纸牌,用于解决创造性问题。抽取一张牌,任何一张,你都会获得一个关于你项目的随机新视角。(如果这听起来太费劲,你现在可以下载一个应用程序,它会帮你抽牌。)伊诺对他们开发这些纸牌的解释与“逃离局部最大值”的想法有着明显的相似之处:
When it comes to stimulating creativity, a common technique is introducing a random element, such as a word that people have to form associations with. For example, musician Brian Eno and artist Peter Schmidt created a deck of cards known as Oblique Strategies for solving creative problems. Pick a card, any card, and you will get a random new perspective on your project. (And if that sounds like too much work, you can now download an app that will pick a card for you.) Eno’s account of why they developed the cards has clear parallels with the idea of escaping local maxima:
当你正忙于某件事时,你会忘记最显而易见的事情。你走出录音室,会想“我们怎么没记得做这个或那个?” 这些卡片其实就是让你跳出框架,稍微打破既定的语境,这样你就不再是一个在录音室里专注于一首歌的乐队,而是一群活生生、活在世上、同时还能感知到很多其他事物的人。
When you’re very in the middle of something, you forget the most obvious things. You come out of the studio and you think “why didn’t we remember to do this or that?” These [cards] really are just ways of throwing you out of the frame, of breaking the context a little bit, so that you’re not a band in a studio focused on one song, but you’re people who are alive and in the world and aware of a lot of other things as well.
随机抖动、脱离框架并聚焦于更大范围,提供了一种方法,可以脱离局部的良好状态,重新追求全局最优状态。
Being randomly jittered, thrown out of the frame and focused on a larger scale, provides a way to leave what might be locally good and get back to the pursuit of what might be globally optimal.
你无需成为布莱恩·伊诺,也能为生活增添一些随机的刺激。例如,维基百科提供了一个“随机条目”链接,汤姆多年来一直将其用作浏览器的默认主页,每次打开新窗口都会看到随机选择的维基百科条目。虽然这还没有带来任何惊人的发现,但他现在对一些鲜为人知的话题(例如智利武装部队使用的刀具类型)有了不少了解,他觉得其中一些话题丰富了他的生活。(例如,他了解到葡萄牙语中有一个词组,意思是“对某种不存在或可能不存在的东西的模糊而持续的渴望”,这个问题我们至今仍无法用搜索引擎解决。)一个有趣的副作用是,他现在不仅对维基百科上涵盖的主题类型有了更好的了解,而且对随机性的真正含义也更加了解。例如,那些感觉与他有某种联系的页面——关于他认识的人或地方的文章——会以令人惊讶的频率出现。 (在一次测试中,他仅重新加载两次就得到了“1962-1965 年西澳大利亚立法委员会成员”的称号,而他自己就是在西澳大利亚长大的。)知道这些实际上是随机生成的,可以让他更好地评估自己一生中遇到的其他“巧合”。
And you don’t need to be Brian Eno to add a little random stimulation to your life. Wikipedia, for instance, offers a “Random article” link, and Tom has been using it as his browser’s default homepage for several years, seeing a randomly selected Wikipedia entry each time he opens a new window. While this hasn’t yet resulted in any striking discoveries, he now knows a lot about some obscure topics (such as the kind of knife used by the Chilean armed forces) and he feels that some of these have enriched his life. (For example, he’s learned that there is a word in Portuguese for a “vague and constant desire for something that does not and probably cannot exist,” a problem we still can’t solve with a search engine.) An interesting side effect is that he now also has a better sense not just of what sorts of topics are covered on Wikipedia, but also of what randomness really looks like. For example, pages that feel like they have some connection to him—articles about people or places he knows—show up with what seems like surprising frequency. (In a test, he got “Members of the Western Australian Legislative Council, 1962–1965” after just two reloads, and he grew up in Western Australia.) Knowing that these are actually randomly generated makes it possible to become better calibrated for evaluating other “coincidences” in the rest of his life.
在现实世界中,你可以加入社区支持农业农场,每周都会为你配送一箱农产品,让你的蔬菜选择随心所欲。正如我们之前所见,社区支持农业订阅确实可能带来时间安排问题,但收到平时不会买的水果和蔬菜,是打破食谱轮换局部最大值的绝佳方法。同样,每月推荐书籍、葡萄酒和巧克力的俱乐部也能让你接触到各种知识、品酒和味蕾,而这些体验你在其他情况下可能永远无法体验到。
In the physical world, you can randomize your vegetables by joining a Community-Supported Agriculture farm, which will deliver a box of produce to you every week. As we saw earlier, a CSA subscription does potentially pose a scheduling problem, but being sent fruits and vegetables you wouldn’t normally buy is a great way to get knocked out of a local maximum in your recipe rotation. Likewise, book-, wine-, and chocolate-of-the-month clubs are a way to get exposed to intellectual, oenophilic, and gustatory possibilities that you might never have encountered otherwise.
你可能会担心,每次都用抛硬币的方式做决定可能会带来麻烦,尤其是和你的老板、朋友和家人。的确,把随机性融入生活并不一定能带来成功。卢克·莱因哈特(本名乔治·考克饶夫)1971年出版的经典小说《骰子人》就是一个警示故事。小说的主人公,一个用掷骰子代替做决定的人,很快就陷入了我们大多数人可能都想避免的境地。
You might worry that making every decision by flipping a coin could lead to trouble, not least with your boss, friends, and family. And it’s true that mainlining randomness into your life is not necessarily a recipe for success. The cult classic 1971 novel The Dice Man by Luke Rhinehart (real name: George Cockcroft) provides a cautionary tale. Its narrator, a man who replaces decision-making with dice rolling, quickly ends up in situations that most of us would probably like to avoid.
但这或许只是一知半解反而危险的例子。如果骰子人对计算机科学有更深的理解,他或许会得到一些指导。首先,根据爬山法:即使你习惯于有时按照坏主意行事,也应该始终按照好主意行事。其次,根据大都会算法:你遵循一个坏主意的可能性应该与这个想法的糟糕程度成反比。第三,根据模拟退火法:你应该预先加载随机性,迅速从完全随机的状态中冷却下来,随着时间的推移,使用的随机性越来越少,在接近冰点时停留时间最长。锻炼自己——字面意思。
But perhaps it’s just a case of a little knowledge being a dangerous thing. If the Dice Man had only had a deeper grasp of computer science, he’d have had some guidance. First, from Hill Climbing: even if you’re in the habit of sometimes acting on bad ideas, you should always act on good ones. Second, from the Metropolis Algorithm: your likelihood of following a bad idea should be inversely proportional to how bad an idea it is. Third, from Simulated Annealing: you should front-load randomness, rapidly cooling out of a totally random state, using ever less and less randomness as time goes on, lingering longest as you approach freezing. Temper yourself—literally.
小说作者并没有忽视最后一点。考克饶夫本人显然也像他的主人公一样,在人生的某个阶段“投机取巧”,和家人在地中海帆船上过着游牧式的生活,就像布朗运动的慢动作一样。然而,在某个时刻,他的“退火计划”冷却下来:他在纽约州北部的一个湖边,舒适地安顿下来,达到了局部极值。如今,他已年逾八旬,却依然心满意足地生活在那里。“一旦你找到了快乐的地方,”他告诉《卫报》,“你再继续摇摆不定就是愚蠢的。”
This last point wasn’t lost on the novel’s author. Cockcroft himself apparently turned, not unlike his protagonist, to “dicing” for a time in his life, living nomadically with his family on a Mediterranean sailboat, in a kind of Brownian slow motion. At some point, however, his annealing schedule cooled off: he settled down comfortably into a local maximum, on a lake in upstate New York. Now in his eighties, he’s still contentedly there. “Once you got somewhere you were happy,” he told the Guardian, “you’d be stupid to shake it up any further.”
*有趣的是,其中一些实验对π的估计值似乎远比偶然预期要好——这表明实验可能被故意缩短到一个合适的停止点,或者干脆就是伪造的。例如,1901年,意大利数学家马里奥·拉扎里尼据称进行了3408次抛掷,得到的π估计 值为 355 / 113 = 3.1415929 ( π的实际值精确到小数点后七位是3.1415927)。但如果指针穿过线的次数只差一次,估计值就会远没有那么准确——3.1398或3.1433——这使得拉扎里尼的报告显得可疑。拉普拉斯或许会觉得,我们能够用贝叶斯规则来证实这个结果不太可能来自有效的实验,这很合适。
*Interestingly, some of these experiments appear to have produced a far better estimate of π than would be expected by chance—which suggests that they may have been deliberately cut short at a good stopping point, or faked altogether. For example, in 1901 the Italian mathematician Mario Lazzarini supposedly made 3,408 tosses and obtained an estimate of π ≈ 355⁄113 = 3.1415929 (the actual value of π to seven decimal places is 3.1415927). But if the number of times the needle crossed the line had been off by just a single toss, the estimate would have been far less pretty—3.1398 or 3.1433—which makes Lazzarini’s report seem suspicious. Laplace might have found it fitting that we can use Bayes’s Rule to confirm that this result is unlikely to have arisen from a valid experiment.
*你不需要检查平方根以外的数,因为如果一个数有一个因数大于它的平方根,那么根据定义,它一定也有一个对应的因数小于它的平方根——所以你应该已经找到了。例如,如果你在寻找100的因数,那么每个大于10的因数都会与一个小于10的因数配对:20对应5,25对应4,依此类推。
*You don’t need to check beyond the square root, because if a number has a factor greater than its square root then by definition it must also have a corresponding factor smaller than the square root—so you would have caught it already. If you’re looking for factors of 100, for instance, every factor that’s greater than 10 will be paired with a factor smaller than 10: 20 is matched up with 5, 25 with 4, and so on.
*孪生素数是连续的奇数,它们都是素数,例如 5 和 7。
*Twin primes are consecutive odd numbers that are both prime, like 5 and 7.
*请注意,我们特意从网站上选取了第一个故事 — — 也就是说,我们没有通读所有故事来挑选一个来分享,否则就会失去意义。
*Note that we deliberately took the very first story from the site—that is, we did not read through all of them to pick one to share, which would have defeated the purpose.
“连接 ”一词含义广泛。它可以指两个实体之间的物理或逻辑路径,可以指路径上的流程,可以推论性地指与路径建立相关的操作,也可以指两个或多个实体之间的关联,无论它们之间是否有路径。
The term connection has a wide variety of meanings. It can refer to a physical or logical path between two entities, it can refer to the flow over the path, it can inferentially refer to an action associated with the setting up of a path, or it can refer to an association between two or more entities, with or without regard to any path between them.
—温特·瑟夫和鲍勃·卡恩
—VINT CERF AND BOB KAHN
仅连接。
Only connect.
—EM FORSTER
—E. M. FORSTER
长途电报的起源是一个预兆——1844 年 5 月 24 日,塞缪尔·F·B·莫尔斯 (Samuel F.B. Morse) 站在美国最高法院的办公室里,给他在巴尔的摩的助手阿尔弗雷德·维尔 (Alfred Vail) 发了一段旧约经文:“上帝创造了什么。”我们对任何新联系首先要问的是它是如何开始的,并且从这个起源出发,我们不禁试图预测它的未来。
The long-distance telegraph began with a portent—Samuel F. B. Morse, standing in the chambers of the US Supreme Court on May 24, 1844, wiring his assistant Alfred Vail in Baltimore a verse from the Old Testament: “WHAT HATH GOD WROUGHT.” The first thing we ask of any new connection is how it began, and from that origin can’t help trying to augur its future.
1876年3月10日,亚历山大·格雷厄姆·贝尔(Alexander Graham Bell)给他的助手打了历史上第一通电话,这通电话的开头有点矛盾。“沃森先生,过来,我想见你。”这既证明了电话能够克服物理距离,又无法克服它。
The first telephone call in history, made by Alexander Graham Bell to his assistant on March 10, 1876, began with a bit of a paradox. “Mr. Watson, come here; I want to see you”—a simultaneous testament to its ability and inability to overcome physical distance.
手机的诞生始于一次自吹自擂——1973年4月3日,摩托罗拉的马丁·库珀走在第六大道上,曼哈顿的行人目瞪口呆,库珀给他的竞争对手AT&T的乔尔·恩格尔打电话:“乔尔,我用手机给你打电话。一部真正的手机:手持式、便携的、真正的手机。”(库珀回忆道:“我不记得他具体说了什么,但有一段时间真的很安静。我猜他当时肯定在咬牙切齿。”)
The cell phone began with a boast—Motorola’s Martin Cooper walking down Sixth Avenue on April 3, 1973, as Manhattan pedestrians gawked, calling his rival Joel Engel at AT&T: “Joel, I’m calling you from a cellular phone. A real cellular phone: a handheld, portable, real cellular phone.” (“I don’t remember exactly what he said,” Cooper recalls, “but it was really quiet for a while. My assumption was that he was grinding his teeth.”)
1992 年 12 月 3 日,这条短信以欢呼声开头:Sema Group Telecoms 的 Neil Papworth 提前祝沃达丰的理查德·贾维斯“圣诞快乐”。
And the text message began, on December 3, 1992, with cheer: Neil Papworth at Sema Group Telecoms wishing Vodafone’s Richard Jarvis an early “Merry Christmas.”
互联网的开端,不知何故,却比这一切都更加卑微和不祥。1969年10月29日,加州大学洛杉矶分校的查理·克莱恩(Charley Kline)向斯坦福研究所的比尔·杜瓦尔(Bill Duvall)发送了第一条通过阿帕网(ARPANET)从一台计算机传输到另一台计算机的消息。这条消息是“login”(登录)——或者说,如果接收机器没有在“lo”之后崩溃的话,它本来应该是这样的。
The beginnings of the Internet were, somehow fittingly, much humbler and more inauspicious than all of that. It was October 29, 1969, and Charley Kline at UCLA sent to Bill Duvall at the Stanford Research Institute the first message ever transmitted from one computer to another via the ARPANET. The message was “login”—or would have been, had the receiving machine not crashed after “lo.”
瞧——事实上,克莱恩不由自主地让自己的声音听起来很不祥,很像《旧约》。
Lo—verily, Kline managed to sound portentous and Old Testament despite himself.
人际交往的基础是礼仪——一套共同遵守的程序和期望,从握手打招呼到礼节、礼貌以及各种社会规范。机器连接也不例外。礼仪是我们达成共识的方式;事实上,这个词源于希腊语protokollon,意为“第一层胶水”,指的是书籍或手稿的外页。
The foundation of human connection is protocol—a shared convention of procedures and expectations, from handshakes and hellos to etiquette, politesse, and the full gamut of social norms. Machine connection is no different. Protocol is how we get on the same page; in fact, the word is rooted in the Greek protokollon, “first glue,” which referred to the outer page attached to a book or manuscript.
在人际关系中,这些规矩往往是微妙却又挥之不去的焦虑之源。不知多少天前,我给某某发了条信息;我什么时候开始怀疑他们根本没收到?现在是下午12:05,我们约好中午打电话;难道我们都以为是对方打来的吗?你的回答似乎有点奇怪;是我听错了还是你听错了?再说吧?
In interpersonal affairs, these protocols prove a subtle but perennial source of anxiety. I sent so-and-so a message however many days ago; at what point do I begin to suspect they never received it? It’s now 12:05 p.m. and our call was set for noon; are we both expecting each other to be the one calling? Your answer seems odd; did I mishear you or did you mishear me? Come again?
从电报到短信,我们之前的大多数通信技术仅仅为我们提供了新的渠道,让我们得以体验这些熟悉的人际沟通挑战。但随着互联网的出现,计算机不仅成为了沟通的渠道,也成为了终端:进行沟通的一方。因此,它们需要负责解决自身的沟通问题。这些机器对机器的问题及其解决方案,既模仿又启发了我们自身的问题。
Most of our communication technology—from the telegraph to the text—has merely provided us with new conduits to experience these familiar person-to-person challenges. But with the Internet, computers became not only the conduit but also the endpoints: the ones doing the talking. As such, they’ve needed to be responsible for solving their own communication issues. These machine-to-machine problems—and their solutions—at once mimic and illuminate our own.
分组交换
Packet Switching
我们现在所理解的“互联网”实际上是许多协议的集合,但其中最主要的(以至于它经常被人们或多或少地与互联网同义)是传输控制协议(TCP)。它诞生于文顿·“文特”·瑟夫和罗伯特·“鲍勃”·卡恩在1973年的一次演讲和1974年的一篇论文中,他们提出了一种他们想象中的“互联网络”的语言方案。
What we now think of as “the Internet” is actually a collection of many protocols, but the chief among them (so much so that it’s often referred to more or less synonymously with the Internet) is what’s known as Transmission Control Protocol, or TCP. It was born from a 1973 talk and a 1974 paper by Vinton “Vint” Cerf and Robert “Bob” Kahn, who laid out a proposal for the language of—as they imagined calling it—an “internetwork.”
TCP 最初使用电话线,但更确切地说,它更像是邮件而非电话的演进。电话通话使用所谓的“电路交换”:系统在发送方和接收方之间打开一个通道,在通话期间为双方提供恒定的带宽。电路交换对于人机交互来说意义非凡,但早在 20 世纪 60 年代,人们就清楚地认识到,这种模式并不适用于机器通信。
TCP initially used telephone lines, but it’s more appropriately regarded as the evolution of the mail rather than the phone. Phone calls use what’s called “circuit switching”: the system opens a channel between the sender and the receiver, which supplies constant bandwidth between the parties in both directions as long as the call lasts. Circuit switching makes plenty of sense for human interaction, but as early as the 1960s it was clear that this paradigm wasn’t going to work for machine communications.
加州大学洛杉矶分校的 Leonard Kleinrock 回忆道,
As UCLA’s Leonard Kleinrock recalls,
我知道,电脑说话的时候,不像我现在这样——持续不断地说话。它们会“砰”的一声!然后安静一会儿。过一会儿,它们又会突然活跃起来,再次发出“砰”的一声。你根本承担不起专门为一个几乎从不说话、但一旦想说话就要求立即接入的机器分配通信连接的代价。所以我们不得不放弃设计用于持续通话的电话网络——电路交换网络——而选择了其他方式。
I knew that computers, when they talk, they don’t talk the way I am now—continuously. They go blast! and they’re quiet for a while. A little while later, they suddenly come up and blast again. And you can’t afford to dedicate a communications connection to something which is almost never talking, but when it wants to talk it wants immediate access. So we had to not use the telephone network, which was designed for continuous talking—the circuit switching network—but something else.
而电话公司似乎并不特别乐意谈论其协议的根本性转变。放弃电路交换被认为是疯狂之举——用网络研究员范·雅各布森的话来说,简直是“彻头彻尾的异端邪说”。克莱因罗克回忆了他自己与电信行业的遭遇:
The telephone companies, for their part, did not seem especially amenable to talk of a fundamental shift in their protocols. Moving away from circuit switching was considered lunatic—“utter heresy,” in the words of networking researcher Van Jacobson. Kleinrock reminisces about his own encounters with the telecommunications industry:
我去了当时最大的电信网络运营商AT&T,我向他们解释,你们应该给我们提供良好的数据通信服务。他们的回答是,你们在说什么?美国就像个铜矿,到处都是电话线,用电话线就行。我说不不不,你们不懂。接通一个电话要35秒,你们至少要收我3分钟的费用,而我要发送100毫秒的数据!他们的回答是:“小子,滚!”于是,小子就和其他人一起开发了这项抢走他们饭碗的技术。
I went to AT&T, the biggest network of the time, and I explained to them, you guys ought to give us good data communications. And their answer was, what are you talking about? The United States is a copper mine, it’s full of telephone wires, use that. I said no, no, you don’t understand. It takes 35 seconds to set up a call, you charge me a minimum of 3 minutes, and I want to send 100 milliseconds of data! And their answer was, “Little boy, go away.” So little boy went away and, with others, developed this technology which ate their lunch.
取代电路交换的技术后来被称为分组交换。在分组交换网络中,发送方和接收方不再为每个连接使用专用信道,而是将消息分解成称为“数据包”的微小碎片,然后将它们合并到公共数据流中——有点像以光速移动的明信片。
The technology that ate circuit switching’s lunch would become known as packet switching. In a packet-switched network, rather than using a dedicated channel for each connection, senders and receivers atomize their messages into tiny shards known as “packets,” and merge them into the communal flow of data—a bit like postcards moving at the speed of light.
在这样的网络中,“你所谓的连接,其实是两个端点之间一种双方同意的幻觉,”苹果网络专家斯图尔特·切希尔(Stuart Cheshire)解释道。“互联网中不存在连接。谈论互联网中的连接就像谈论美国邮政系统中的连接一样。你给别人写信,每封信都是独立发送的——你或许有来来回回的信件,并且有一定的连续性,但美国邮政不需要知道这些……他们只是负责投递信件。”
In such a network, “what you might call a connection is a consensual illusion between the two endpoints,” explains Apple networking expert Stuart Cheshire. “There are no connections in the Internet. Talking about a connection in the Internet is like talking about a connection in the US Mail system. You write letters to people and each letter goes independently—and you may have a correspondence that goes back and forth and has some continuity to it, but the US Mail doesn’t need to know about that.… They just deliver the letters.”
高效利用带宽并非20世纪60年代推动分组交换研究的唯一考虑因素,另一个因素是核战争。兰德公司的保罗·巴兰(Paul Baran)试图解决网络鲁棒性问题,以便军事通信能够在遭受核攻击(即使网络的大部分被摧毁)后依然能够正常运作。受20世纪50年代开发的迷宫导航算法的启发,巴兰设想了一种设计,即使网络发生动态变化,甚至遭到破坏,每条信息都能独立地到达目的地。
Efficient use of bandwidth wasn’t the only consideration driving research into packet switching in the 1960s; the other was nuclear war. Paul Baran at the RAND Corporation was trying to solve the problem of network robustness, so that military communications could survive a nuclear attack that took out a sizable fraction of the network. Inspired by algorithms developed in the 1950s for navigating mazes, Baran imagined a design in which every piece of information could independently make its own way to its destination, even as the network was changing dynamically—or being torn to tatters.
这是电路交换及其专用稳定连接的第二个缺点:正是这种稳定性导致掉线的通话一直处于掉线状态。电路交换的灵活性和适应性不足以实现稳健性。而分组交换在这方面也能满足时代的需求。在电路交换网络中,任何一条链路中断,通话就会失败——这意味着随着网络规模的扩大,可靠性会呈指数级下降。另一方面,在分组交换中,在不断扩展的网络中,路径的增多反而成为一种优势:现在数据流动的路径越来越多,因此网络的可靠性也随着规模的扩大而呈指数级增长。
This was the second demerit against circuit switching and its dedicated, stable connections: that very stability meant that a dropped call stayed dropped. Circuit switching just wasn’t flexible or adaptable enough to be robust. And here, too, packet switching could offer just what the times were calling for. In circuit-switched networks, a call fails if any one of its links gets disrupted—which means that reliability goes down exponentially as a network grows larger. In packet switching, on the other hand, the proliferation of paths in a growing network becomes a virtue: there are now that many more ways for data to flow, so the reliability of the network increases exponentially with its size.
然而,正如范·雅各布森所说,即使在分组交换技术发明之后,电话公司也并不为之所动。“所有电信公司的人都大声疾呼,那根本算不上网络!那只是一种糟糕的网络使用方式!你们占用我们的线路,在我们创建的路径上传输数据!而且还在上面加了一堆垃圾,导致网络使用效率低下。” 但从分组交换的角度来看,电话线只是一种手段;发送方和接收方实际上并不关心数据包是如何传送的。能够跨多种不同的介质进行独立操作,才是分组交换技术的一大优势。在20世纪60年代末70年代初的早期网络(例如阿帕网)证明了这一概念的可行性之后,各种类型的网络开始在全国各地涌现,不仅通过铜质电话线进行分组交换,还通过卫星和无线电进行分组交换。 2001 年,挪威卑尔根市的一组计算机科学家甚至短暂地通过“鸟类载体”实现了分组交换网络——即将数据包写在纸上并绑在鸽子的脚上。
Still, as Van Jacobson tells it, even after packet switching was devised, the phone companies were unimpressed. “All the telco people said, with very loud voices, that’s not a network! That’s just a crummy way to use our network! You’re taking our wires, you’re sending on the paths that we create! And you’re putting a lot of extra gunk on it so that you use it really inefficiently.” But from a packet-switching point of view, the phone wires are just a means to an end; the sender and receiver don’t actually care how the packets get delivered. The ability to operate agnostically over any number of diverse media would be packet switching’s great virtue. After early networks in the late ’60s and early ’70s, such as the ARPANET, proved the viability of the concept, networks of all types began sprouting across the country, doing packet switching not only over copper phone wires, but over satellites and over radio. In 2001, a group of computer scientists in the Norwegian city of Bergen briefly even implemented a packet-switching network over “Avian Carriers”—that is, packets written down on paper and tied to pigeons’ feet.
当然,分组交换也存在自身的问题。首先,对于任何协议,无论是人还是机器,首先要问的问题很简单:如何知道你的信息已经成功传递?
Of course, packet switching would not be without its own problems. For starters, one of the first questions for any protocol, human or machine, is, quite simply: how do you know your messages are getting through?
致谢
Acknowledgment
没有任何传输能够做到 100% 可靠。
No transmission can be 100 percent reliable.
—温特·瑟夫和鲍勃·卡恩
—VINT CERF AND BOB KAHN
“上帝创造了什么?”不仅是美国发出的第一条长途电报,也是第二条:阿尔弗雷德·维尔将这段引文发回给最高法院办公室的莫尔斯,以确认收到。
“WHAT HATH GOD WROUGHT” wasn’t just the first long-distance telegraph message sent in the United States. It was also the second: Alfred Vail sent the quotation back to Morse in the Supreme Court chambers as a way of confirming receipt.
现在,韦尔的回复可以让莫尔斯以及聚集在他周围的美国议员们确信莫尔斯的信息已经收到——当然,前提是韦尔事先并不知道信息的选择。但是,什么能让韦尔确信他的确认已经收到呢?
Now, Vail’s reply could make Morse, and the US legislators gathered around him, confident that Morse’s message had been received—presuming, of course, that Vail hadn’t known the choice of message in advance. But what would make Vail confident that his confirmation had been received?
计算机科学家将这个概念称为“拜占庭将军问题”。想象一下,两位将军分别位于山谷的两端,而山谷里有他们共同的敌人,他们试图协调进攻。只有完美同步才能成功;任何一方单独进攻都无异于自杀。更糟糕的是,一位将军向另一位将军传递的任何信息都必须亲自穿过敌人所在的地形,这意味着任何信息都可能永远无法到达。
Computer scientists know this concept as the “Byzantine generals problem.” Imagine two generals, on opposite sides of a valley that contains their common enemy, attempting to coordinate an attack. Only by perfect synchronization will they succeed; for either to attack alone is suicide. What’s worse, any messages from one general to the other must be delivered by hand across the very terrain that contains the enemy, meaning there’s a chance that any given message will never arrive.
假设第一位将军建议了进攻的时间,但除非他确信他的战友也在行动,否则他不敢进攻。第二位将军收到命令并发回确认——但除非他知道第一位将军收到了确认,否则他不敢进攻(否则第一位将军不会出击)。第一位将军收到了确认——但在确定第二位将军知道他已经知道之前,他不会进攻。遵循这条逻辑链需要一系列无限的信息,显然这是行不通的。沟通是那些只在实践中起作用的令人愉快的事情之一;在理论上它是不可能的。
The first general, say, suggests a time for the attack, but won’t dare go for it unless he knows for sure that his comrade is moving, too. The second general receives the orders and sends back a confirmation—but won’t dare attack unless he knows that the first general received that confirmation (since otherwise the first general won’t be going). The first general receives the confirmation—but won’t attack until he’s certain that the second general knows he did. Following this chain of logic requires an infinite series of messages, and obviously that won’t do. Communication is one of those delightful things that work only in practice; in theory it’s impossible.
在大多数情况下,通信中断的后果很少如此严重,对确定性的需求也很少如此绝对。在TCP中,故障通常会导致重传而不是终止,因此会话以所谓的“三次握手”开始就足够了。访问者发出“你好”,服务器确认并回复“你好”,访问者确认,如果服务器收到这第三条消息,则无需进一步确认,双方就可以开始通信了。然而,即使建立了初始连接,仍然存在一些后续数据包在传输过程中损坏或丢失,或者乱序到达的风险。在邮政邮件中,可以通过回执确认包裹投递;在线通信中,数据包投递由所谓的确认数据包(ACK)确认。这些对于网络的正常运行至关重要。
In most scenarios the consequences of communication lapses are rarely so dire, and the need for certainty rarely so absolute. In TCP, a failure generally leads to retransmission rather than death, so it’s considered enough for a session to begin with what’s called a “triple handshake.” The visitor says hello, the server acknowledges the hello and says hello back, the visitor acknowledges that, and if the server receives this third message, then no further confirmation is needed and they’re off to the races. Even after this initial connection is made, however, there’s still a risk that some later packets may be damaged or lost in transit, or arrive out of order. In the postal mail, package delivery can be confirmed via return receipts; online, packet delivery is confirmed by what are called acknowledgment packets, or ACKs. These are critical to the functioning of the network.
ACK 的工作方式既简单又巧妙。在三次握手的背后,每台机器都会向对方提供一种序列号——并且众所周知,此后发送的每个数据包都会将这些序列号加一,就像支票簿上的支票一样。例如,如果你的计算机发起与 Web 服务器的联系,它可能会向该服务器发送数字 100。服务器发送的 ACK 会依次指定服务器自身数据包的起始序列号(假设为 5,000),并且会显示“Ready for 101”。你的机器的 ACK 将携带数字 101,并依次传达“Ready for 5,001”。(请注意,这两种编号方案完全独立,每个序列的起始数字通常是随机选择的。)
The way that ACKs work is both simple and clever. Behind the scenes of the triple handshake, each machine provides the other with a kind of serial number—and it’s understood that every packet sent after that will increment those serial numbers by one each time, like checks in a checkbook. For instance, if your computer initiates contact with a web server, it might send that server, say, the number 100. The ACK sent by the server will in turn specify the serial number at which the server’s own packets will begin (call it 5,000), and also will say “Ready for 101.” Your machine’s ACK will carry the number 101 and will convey in turn “Ready for 5,001.” (Note that these two numbering schemes are totally independent, and the number that begins each sequence is typically chosen at random.)
这种机制提供了一种便捷的方法来精确定位数据包何时丢失。如果服务器期待数据包 101,但却收到了 102,它会向数据包 102 发送一个 ACK,仍然提示“已准备好接收 101”。如果它接下来收到数据包 103,它会再次发送“已准备好接收 101”。连续三个这样的冗余 ACK 会向你的机器发出信号,表明 101 不仅仅是延迟了,而且已经彻底丢失了,因此它会重新发送该数据包。此时,服务器(保留了数据包 102 和 103)将发送一个 ACK,提示“已准备好接收 104”,表示数据包序列已恢复。
This mechanism offers a ready way to pinpoint when packets have gone astray. If the server is expecting 101 but instead gets 102, it will send an ACK to packet 102 that still says “Ready for 101.” If it next gets packet 103, it will say, again, “Ready for 101.” Three such redundant ACKs in a row would signal to your machine that 101 isn’t just delayed but hopelessly gone, so it will resend that packet. At that point, the server (which has kept packets 102 and 103) will send an ACK saying “Ready for 104” to signal that the sequence has been restored.
所有这些确认实际上会累积成相当大的流量。我们通常认为,大型文件传输是单向操作,但实际上接收方会向发送方发送数百条“控制消息”。2014年下半年的一份报告显示,高峰时段近10%的上行互联网流量来自Netflix——我们倾向于认为Netflix几乎只向下游用户发送数据。但所有这些视频都会产生大量的确认消息。
All those acknowledgments can actually add up to a considerable amount of traffic. We think of, say, a large file transfer as a one-way operation, but in fact the recipient is sending hundreds of “control messages” back to the sender. A report from the second half of 2014 showed that almost 10% of upstream Internet traffic during peak hours was due to Netflix—which we tend to think of as sending data almost exclusively downstream, to users. But all that video generates an awful lot of ACKs.
在人类世界中,对信息是否被接收的焦虑同样弥漫在对话中。说话的人可能会下意识地在每句话的末尾加上“你知道吗?”,而听话的人则会情不自禁地点头、点头、点头、点头、点头、点头。即使面对面交流,我们也会这样做,但在电话中,有时这是唯一能确定通话是否仍在进行的方式。难怪21世纪最成功的无线运营商营销活动,会反复引用网络工程师的质控口头禅:“你现在能听到我说话吗?”
In the human sphere, the anxiety that the message is indeed being received similarly pervades conversation. A speaker might subconsciously append “You know?” to the end of every sentence, and a listener, for their part, can’t help but make a steady stream of nods, yeahs, aye-ayes, roger-thats, ten-fours, uh-huhs. We do this even face-to-face, but on a phone call sometimes it’s the only way to know the call is even still in progress. No wonder that the most successful twenty-first-century marketing campaign for a wireless carrier featured a network engineer’s quality-control catchphrase, repeated again and again: “Can you hear me now?”
当这种反复沟通出现问题时,我们常常会留下一个疑问。正如软件博主 Tyler Treat 所说:
When something goes wrong in that back-and-forth, we’re often left with a question mark. As software blogger Tyler Treat says,
在分布式系统中,我们试图通过等待消息收到确认来保证消息的传递,但各种各样的事情都可能出错。消息丢了吗?确认丢了吗?接收方崩溃了吗?是他们速度慢吗?是网络慢吗?还是我速度慢?
In a distributed system, we try to guarantee the delivery of a message by waiting for an acknowledgement that it was received, but all sorts of things can go wrong. Did the message get dropped? Did the ack get dropped? Did the receiver crash? Are they just slow? Is the network slow? Am I slow?
正如他提醒我们的那样,拜占庭将军面临的问题“不是设计的复杂性,而是不可能的结果”。
The issues faced by the Byzantine generals, as he reminds us, “are not design complexities, they are impossibility results.”
温特·瑟夫指出,早期的网络研究“建立在这样一个假设之上:你可以构建一个可靠的底层网络”。另一方面,“互联网则建立在这样一个假设之上:没有哪个网络是必然可靠的,你必须进行端到端的重传才能恢复。”
Earlier networking research, Vint Cerf notes, had been founded “on the assumption that you could build a reliable underlying net.” On the other hand, “the Internet was based on the assumption that no network was necessarily reliable, and you had to do end-to-end retransmissions to recover.”
讽刺的是,传输人声却是一个少数例外。实时语音通信(例如 Skype)通常不使用TCP,而 TCP 是互联网大部分底层的基础。正如研究人员在网络发展早期发现的那样,使用可靠、健壮的协议(包括所有 ACK 和丢失数据包的重传)来传输人声是矫枉过正。健壮性是由人自己提供的。正如瑟夫所解释的那样:“就语音而言,如果丢失了一个数据包,你只需说,‘再说一遍,我漏掉了什么。’”
Ironically, one of the few exceptions to this is in transmitting the human voice. Real-time voice communications, such as Skype, typically do not use TCP, which underlies most of the rest of the Internet. As researchers discovered in the early days of networking, using reliable, robust protocols—with all their ACKs and retransmission of lost packets—to transmit the human voice is overkill. The humans provide the robustness themselves. As Cerf explains, “In the case of voice, if you lose a packet, you just say, ‘Say that again, I missed something.’”
因此,那些自动将背景噪音降至静音的电话服务,对用户来说无疑是极大的伤害。背景静电噪音不断提醒用户通话仍在进行中,任何静音都是对方故意为之。如果没有它,通话双方就必须时刻面对通话断线的可能性,并不断向对方保证通话没有断线。这也是所有分组交换协议的焦虑所在,事实上,任何基于异步通话轮换的媒介——无论是写信、发短信,还是在线约会中反复试探性的对话——都存在这种焦虑。每条信息都可能是最后一条,而且通常很难区分是有人在慢慢回复,还是有人早已结束对话。
For this reason, phone services that automatically reduce background noise to silence are doing their users a major disservice. Background static is a continual reassurance that the call is still connected and that any silence is a deliberate choice by the other party. Without it, one must constantly confront the possibility that the call has dropped, and constantly offer reassurances that it has not. This, too, is the anxiety of all packet-switching protocols, indeed of any medium rooted in asynchronous turn-taking—be it letter writing, texting, or the tentative back-and-forths of online dating. Every message could be the last, and there is often no telling the difference between someone taking their time to respond and someone who has long since ended the conversation.
那么,我们究竟应该如何对待不可靠的人或计算机呢?
So how exactly should we handle a person—or a computer—that’s unreliable?
第一个问题是,我们应该将多长的无响应时间视为网络故障。这部分取决于网络的性质:通过电话,几秒钟后我们就会开始担心;通过电子邮件,几天后我们就会开始担心;通过信件,几周后我们就会开始担心。发送方和接收方之间的往返时间越长,沉默变得重要所需的时间就越长——在发送方意识到问题之前,可能“飞行”的信息就越多。在网络中,让各方适当调整对确认及时性的预期,对于系统正常运行至关重要。
The first question is how long a period of nonresponsiveness we should take to constitute a breakdown. Partly this depends on the nature of the network: we start to worry in a matter of seconds over the phone, days over email, and weeks over postal mail. The longer the round-trip time between sender and receiver, the longer it takes a silence to be significant—and the more information can be potentially “in flight” before the sender realizes there’s a problem. In networking, having the parties properly tune their expectations for the timeliness of acknowledgments is crucial to the system functioning correctly.
当然,第二个问题是,一旦我们认识到故障,我们究竟应该怎么做。
The second question, of course, once we do recognize a breakdown, is what exactly we should do about it.
指数退避:宽恕算法
Exponential Backoff: The Algorithm of Forgiveness
世界上最难翻译的单词被认定为“ilunga”,源自刚果民主共和国东南部的奇卢巴语……Ilunga 的意思是“一个人第一次愿意原谅任何虐待,第二次愿意容忍,但绝不会第三次”。
The world’s most difficult word to translate has been identified as “ilunga,” from the Tshiluba language spoken in south-eastern DR Congo.… Ilunga means “a person who is ready to forgive any abuse for the first time, to tolerate it a second time, but never a third time.”
— BBC新闻
—BBC NEWS
如果一开始你没有成功,请再试一次。
If at first you don’t succeed, / Try, try again.
—TH帕尔默
—T. H. PALMER
如今,即使有线连接很方便,我们也希望设备能够进行无线通信——例如,我们的键盘和鼠标可以与几英寸外的电脑进行无线通话。然而,无线网络的出现源于一种必然,在一个有线连接无法实现这一目标的地方:夏威夷。20世纪60年代末70年代初,檀香山夏威夷大学的诺曼·艾布拉姆森(Norman Abramson)试图将分布在四个岛屿、方圆数百英里的七个校区和众多研究机构连接起来。他突发奇想,通过无线电而非电话系统实现分组交换,用松散的发射器和接收器链路连接各个岛屿。这个系统后来被称为ALOHAnet。
Today we expect our devices to communicate wirelessly even when wires would be easy—our keyboard and mouse, for instance, talking wirelessly with a computer sitting inches away. But wireless networking began as a matter of necessity, in a place where no wires could do the job: Hawaii. In the late ’60s and early ’70s, Norman Abramson at the University of Hawaii in Honolulu was trying to link together the university’s seven campuses and many research institutes, spread across four islands and hundreds of miles. He hit upon the idea of implementing packet switching via radio rather than the phone system, connecting the islands with a loose chain of transmitters and receivers. This system would come to be known as the ALOHAnet.
ALOHAnet 面临的最大挑战是干扰。有时两个站点会同时发射信号,无意中干扰了彼此的信号。(当然,这在人类对话中也很常见。)如果两个站点都立即重新发射信号,试图将信息传达出去,那么它们将面临永远陷入干扰的风险。显然,ALOHAnet 协议需要告诉竞争信号如何相互留出空间,如何相互让路。
The biggest hurdle that the ALOHAnet had to overcome was interference. Sometimes two stations would transmit at the same moment, inadvertently jamming one another’s signals. (This is, of course, a familiar feature in human conversation as well.) If both stations simply retransmitted right away to try to get their message across, they’d run the risk of getting stuck in perpetual interference forever. Clearly the ALOHAnet protocol was going to need to tell competing signals how to give each other space, how to yield and make way for one another.
发送者需要做的第一件事就是所谓的“打破对称性”。任何一位人行道上的行人都知道,当迎面而来的行人闪避左边时,你也闪避右边,然后你们俩同时闪避到另一边,这并不能解决任何问题。当两个说话者都停顿一下,向对方做出尊重的手势,然后同时开始说话时,情况也是如此;或者当两辆车在十字路口,各自停下来让对方先行时,试图同步加速时,情况也是如此。在这个领域,随机性的使用变得至关重要——事实上,没有随机性,网络就不可能存在。
The first thing that the senders need to do here is what’s called “breaking symmetry.” As any sidewalk pedestrian knows, dodging right as an oncoming walker dodges left, and then having both of you simultaneously dodge back the other way, doesn’t solve anything. It’s the same story when two speakers both pause, make gestures of deference to the other, and then start to speak again at the same time; or when two cars at an intersection, each having stopped to yield to the other, try to accelerate in sync. This is an area where the use of randomness becomes essential—indeed, networking wouldn’t be possible without it.
一个简单的解决方案是让每个站点抛硬币。如果是正面,站点就重传;如果是反面,站点就等待一轮,然后再重传。当然,其中一个站点很快就会毫无争议地通过。当只有两个发送者时,这种方法效果很好。但如果同时有三个信号呢?或者四个?那时,网络需要四分之一的概率才能通过哪怕一个数据包(之后仍然会剩下三个冲突的站点,甚至可能同时有更多竞争信号到达)。随着冲突数量的进一步增加,网络的吞吐量可能会急剧下降。1970 年的一份关于 ALOHAnet 的报告指出,当无线电波的平均利用率超过 18.6% 时,“信道就会变得不稳定……平均重传次数将变得无限制”。这可不是什么好主意。
One straightforward solution is to have each station flip a coin. Heads, it retransmits; tails, it waits a turn, then retransmits. Surely one of them will get through uncontested before long. This works well enough when there are only two senders. But what if there are three simultaneous signals? Or four? It would take a one-in-four chance for the network to get even a single packet through at that point (after which you’d still have three conflicting stations left, and perhaps even more competing signals arriving meanwhile). As the number of conflicts increases further, the network’s throughput could simply fall off a cliff. A 1970 report on the ALOHAnet said that above a mere 18.6% average utilization of the airwaves, “the channel becomes unstable … and the average number of retransmissions becomes unbounded.” Not good.
那么,该怎么办呢?有没有办法建立一个系统来避免这种命运?
So, what to do? Is there a way to make a system that could avoid this fate?
最终的突破在于,每次连续失败后,平均延迟都会增加——具体来说,就是在尝试再次传输之前,将潜在延迟加倍。因此,在首次失败后,发送方会随机地在一到两次尝试后重传;在第二次失败后,它会在一到四次尝试后再次尝试;如果连续第三次失败,则意味着需要等待一到八次尝试,以此类推。这种巧妙的方法使网络能够容纳任意数量的竞争信号。由于最大延迟长度(2、4、8、16……)呈指数级增长,因此被称为指数退避。
The breakthrough turned out to be increasing the average delay after every successive failure—specifically, doubling the potential delay before trying to transmit again. So after an initial failure, a sender would randomly retransmit either one or two turns later; after a second failure, it would try again anywhere from one to four turns later; a third failure in a row would mean waiting somewhere between one and eight turns, and so on. This elegant approach allows the network to accommodate potentially any number of competing signals. Since the maximum delay length (2, 4, 8, 16…) forms an exponential progression, it’s become known as Exponential Backoff.
指数退避算法是ALOHAnet自1971年起成功运行的重要组成部分,并在20世纪80年代被嵌入TCP,成为互联网的重要组成部分。几十年过去了,它依然是互联网的重要组成部分。正如一篇颇具影响力的论文所述:“对于嵌入在拓扑结构未知、竞争对话数量未知且不断变化的网络中的传输端点,只有一种方案有望奏效——指数退避算法。”
Exponential Backoff was a huge part of the successful functioning of the ALOHAnet beginning in 1971, and in the 1980s it was baked into TCP, becoming a critical part of the Internet. All these decades later, it still is. As one influential paper puts it, “For a transport endpoint embedded in a network of unknown topology and with an unknown, unknowable and constantly changing population of competing conversations, only one scheme has any hope of working—exponential backoff.”
但该算法的其他用途却蕴含着更具规范性和更深刻的意义。除了避免碰撞之外,指数退避算法已成为处理几乎所有网络故障或不可靠情况的默认方法。例如,当你的计算机尝试访问一个看似已宕机的网站时,它会使用指数退避算法——一秒钟后重试,几秒钟后再重试,依此类推。这对每个人都有好处:它可以防止宕机的主机服务器在恢复上线后立即被大量请求淹没,也可以防止你自己的机器浪费太多精力试图“从石头里榨出血”。但有趣的是,它也不会强迫(或允许)你的机器完全放弃。
But it is the algorithm’s other uses that suggest something both more prescriptive and more profound. Beyond just collision avoidance, Exponential Backoff has become the default way of handling almost all cases of networking failure or unreliability. For instance, when your computer is trying to reach a website that appears to be down, it uses Exponential Backoff—trying again one second later, again a few seconds after that, and so forth. This is good for everyone: it prevents a host server that’s down from getting slammed with requests as soon as it comes back online, and it prevents your own machine from wasting too much effort trying to get blood from a stone. But interestingly, it also does not force (or allow) your machine to ever completely give up.
指数退避算法也是网络安全的关键组成部分。当账户登录密码连续失败时,系统会以指数级增长的锁定时间进行惩罚。这可以防止黑客对账户进行“字典攻击”,即循环尝试一个又一个可能的密码,直到最终幸运地获得成功。同时,它还解决了另一个问题:账户的真正所有者,无论多么健忘,在任意中断后都不会被永久锁定。
Exponential Backoff is also a critical part of networking security, when successive password failures in logging into an account are punished by an exponentially increasing lockout period. This prevents a hacker from using a “dictionary attack” against an account, cycling through potential password after password until eventually they get lucky. At the same time it also solves another problem: the account’s real owner, no matter how forgetful, is never permanently locked out after some arbitrary cutoff.
在人类社会中,我们倾向于采取一种策略,即连续给予人们有限次机会,然后彻底放弃。三次机会,你就出局了。这种模式在几乎所有需要宽恕、宽容或坚持的情况下都默认存在。简而言之,也许我们做错了。
In human society, we tend to adopt a policy of giving people some finite number of chances in a row, then giving up entirely. Three strikes, you’re out. This pattern prevails by default in almost any situation that requires forgiveness, lenience, or perseverance. Simply put, maybe we’re doing it wrong.
我们一位朋友最近想起了儿时玩伴,她有个令人不安的习惯,就是不按时赴约。该怎么办?让她彻底决定受够了,彻底放弃这段感情,这似乎有些武断和刻薄,但继续不断地重新安排约会又显得幼稚,很容易导致无尽的失望和时间的浪费。解决方案:指数级地降低邀请率。试着在一周后重新安排约会,然后是两周、四周、八周。“重传”率最终会趋近于零——但你永远不必完全放弃。
A friend of ours recently mused about a childhood companion who had a disconcerting habit of flaking on social plans. What to do? Deciding once and for all that she’d finally had enough and giving up entirely on the relationship seemed arbitrary and severe, but continuing to persist in perpetual rescheduling seemed naïve, liable to lead to an endless amount of disappointment and wasted time. Solution: Exponential Backoff on the invitation rate. Try to reschedule in a week, then two, then four, then eight. The rate of “retransmission” goes toward zero—yet you never have to completely give up.
我们的另一位朋友苦苦思索,是否要为一位有吸毒史的家人提供住所和经济援助。她既舍不得放弃他能扭转局面的希望,又无法忍受彻底抛弃他。但她又无法接受他为了住进家门而付出的一切——给他买衣服、做饭、重新开立银行账户、每天早上开车送他上班——然而,在某个神秘而突如其来的时刻,他却卷走所有钱消失得无影无踪,几周后又再次打电话请求原谅,重新接纳他。这似乎是一个悖论,一个残酷而不可能的选择。
Another friend of ours agonized about whether to offer shelter and financial assistance to a family member with a history of drug addiction. She couldn’t bear to give up hope that he would turn things around, and couldn’t bear the thought of turning her back on him for good. But she also couldn’t bring herself to do all that it required to have him in her house—buying him clothes and cooking for him, reopening bank accounts for him, and driving him to work each morning—when at some mysterious and abrupt moment he would take all the money and disappear, only to call again several weeks later and ask to be forgiven and taken back in. It seemed like a paradox, a cruel and impossible choice.
指数退避并非万能药,但它确实提供了一种可能的解决方法。例如,要求戒酒时间呈指数级增长,可以抑制再次违反家规的动机。这会让家庭成员更加努力地证明自己真的想回来,同时也能保护房东免受这种循环带来的持续压力。或许最重要的是,房东永远不必告诉亲戚,她已经彻底放弃了他,或者他已经无可救药了。这提供了一种拥有有限耐心和无限仁慈的方法。或许我们不必做出选择。
Exponential Backoff isn’t a magic panacea in cases like this, but it does offer a possible way forward. Requiring an exponentially increasing period of sobriety, for instance, would offer a disincentive to violate the house rules again. It would make the family member prove ever more assiduously that he was serious about returning, and would protect the host from the otherwise continuous stress of the cycle. Perhaps most importantly, the host would never have to tell her relative that she’d given up on him for good or that he was beyond redemption. It offers a way to have finite patience and infinite mercy. Maybe we don’t have to choose.
事实上,过去十年,司法系统本身处理毒品犯罪者社区监管的方式已经开始悄然发生革命。这场革命由一个名为“希望”(HOPE)的试点项目引领,该项目运用了ALOHAnet的指数退避原理——巧合的是,该项目的起点恰好是ALOHAnet的诞生地:檀香山。
In fact, the past decade has seen the beginnings of a quiet revolution in the way the justice system itself handles community supervision for drug offenders. That revolution is being spearheaded by a pilot program called HOPE, which uses the Exponential Backoff principles of the ALOHAnet—and which, in a striking coincidence, began at the birthplace of the ALOHAnet itself: Honolulu.
史蒂文·阿尔姆(Steven Alm)法官在夏威夷第一巡回法院宣誓就职后不久,就注意到了一个令人匪夷所思的模式。缓刑犯会反复违反缓刑条款,巡回法官通常会酌情给予警告,使其免于处罚。但到了某个时候,或许是违规十几次甚至更多之后,法官就会决定更加严厉,判处违规者以年为单位的监禁。阿尔姆说:“我觉得,试图改变任何人的行为,这真是太疯狂了。” 因此,阿尔姆提出了几乎完全相反的建议。HOPE项目并非像以往那样安排在很长一段时间后才进行的违规听证会,这些听证会需要做出不确定的判断,有时还会判处巨额罚款。相反,HOPE项目基于预先设定的即时惩罚,惩罚从入狱一天开始,每次事件发生后处罚力度都会增加。司法部开展的一项为期五年的研究报告显示,HOPE项目的缓刑犯因新罪行被捕或缓刑被撤销的可能性只有普通缓刑犯的一半。而且,他们吸毒的可能性降低了72%。 17 个州已效仿夏威夷的做法,推出了各自版本的 HOPE。
Shortly after being sworn in to Hawaii’s First Circuit Court, Judge Steven Alm noticed a remarkable pattern. Probationers would repeatedly violate their probation terms, and circuit judges would routinely use their discretion to let them off with a warning. But at some point, perhaps after a dozen or more violations, the judge would decide to be strict, and assign the violator a prison sentence measured in years. Says Alm, “I thought, what a crazy way to try to change anybody’s behavior.” So Alm proposed almost exactly the opposite. In place of violation hearings scheduled a long time into the future, requiring uncertain judgment calls, and occasionally producing huge penalties, HOPE is based on immediate, predefined punishments that begin with just one day in jail and increase after each incident. A five-year study by the Department of Justice reported that HOPE probationers were half as likely as regular probationers to be arrested for a new crime or have their probation revoked. And they were 72% less likely to use drugs. Seventeen states have followed Hawaii’s lead and launched their own versions of HOPE.
流量控制和拥塞避免
Flow Control and Congestion Avoidance
计算机网络最初的尝试侧重于在不可靠的链路上建立可靠的传输。这些努力被证明非常成功,以至于第二个问题随之而来:如何确保超载的网络能够避免灾难性的崩溃。TCP 刚解决了从 A 点到 B 点的数据传送问题,就面临着网络拥堵的问题。
The first efforts at computer networking focused on establishing reliable transmissions over unreliable links. These efforts proved to be so successful that a second concern immediately arose: making sure that an overloaded network could avoid catastrophic meltdown. No sooner had TCP solved the problem of getting data from point A to point B than it was confronted with the problem of gridlock.
最重要的早期预警出现在1986年,当时一条连接劳伦斯伯克利实验室和加州大学伯克利分校的线路上,两校之间大约有一个足球场那么长。(在伯克利,这段距离恰好就是一个真正的足球场。)有一天,这条线路的带宽突然从通常的每秒32000比特下降到每秒只有40比特。受害者,劳伦斯伯克利实验室的范·雅各布森和加州大学伯克利分校的迈克尔·卡雷尔斯,“对带宽突然下降千倍感到震惊,并开始调查情况为何变得如此糟糕。”
The most significant early warning came in 1986, on a line connecting the Lawrence Berkeley Laboratory and the UC Berkeley campus, which are separated by about the length of a football field. (At Berkeley, the space happens to be filled with an actual football field.) One day, the bandwidth of that line dropped abruptly from its typical 32,000 bits per second to just 40 bits per second. The victims, Van Jacobson at LBL and Michael Karels at UCB, “were fascinated by this sudden factor-of-thousand drop in bandwidth and embarked on an investigation of why things had gotten so bad.”
与此同时,他们听到全国各地其他网络小组也遇到了同样的问题。雅各布森开始研究底层代码。“协议里是不是有什么错误?”他心想。“这玩意儿在小规模测试中运行正常,然后突然就崩溃了。”
Meanwhile, they heard murmurings from other networking groups across the country who were running into the same thing. Jacobson began looking into the underlying code. “Is there some mistake in the protocol?” he wondered. “This thing was working on smaller-scale tests, and then it suddenly fell apart.”
电路交换和分组交换之间最大的区别之一在于它们如何处理拥塞。在电路交换中,系统要么批准信道请求,要么在无法满足请求的情况下直接拒绝。正因如此,如果您曾在高峰时段尝试使用电话系统,您可能会听到“特殊信息音”和“所有电路忙”的提示信息。
One of the biggest differences between circuit switching and packet switching emerges in how they deal with congestion. In circuit switching, the system either approves a channel request, or denies it outright if the request cannot be accommodated. That’s why, if you’ve ever tried using a phone system during some peak time, you may have encountered the “special information tone” and message proclaiming that “all circuits are busy.”
分组交换则截然不同。电话系统会变得拥挤不堪;邮件系统会变得缓慢。网络中没有任何东西可以明确地告诉发送者有多少其他发送者,或者网络在任何特定时刻的拥堵程度,而且拥堵程度一直在变化。因此,发送者和接收者不仅必须进行通信,还必须进行元通信:他们需要确定数据应该以多快的速度发送。各种数据包流——没有明确的管理或协调——必须以某种方式彼此避开,并快速利用任何新的可用空间。
Packet switching is radically different. The phone system gets full; the mail system gets slow. There’s nothing in the network to explicitly tell a sender how many other senders there are, or how congested the network is at any given moment, and the amount of congestion is constantly changing. Therefore, the sender and receiver must not only communicate but metacommunicate: they need to figure out how fast the data should be sent. Somehow, assorted packet flows—without explicit management or coordination—must both get out of each other’s way and quickly take advantage of any newly available space.
Jacobson 和 Karels 的侦查工作的成果是一套经过修改的流量控制和拥塞避免算法——这是四十年来对 TCP 的最大修改之一。
The result of Jacobson and Karels’s detective work was a revised set of flow control and congestion-avoidance algorithms—one of the biggest modifications to TCP in forty years.
TCP 拥塞控制的核心是一种称为“加法增加,乘法减少”的算法,简称 AIMD。在 AIMD 生效之前,新连接会快速提升传输速率:如果第一个数据包成功接收,则会再发送两个数据包;如果两个数据包都成功接收,则会发送一批四个数据包,以此类推。但是,只要有任何数据包的 ACK 未返回发送方,AIMD 算法就会接管。在 AIMD 算法下,任何一批完全接收的数据包都会导致传输中的数据包数量不翻倍,而仅增加 1;丢弃的数据包会导致传输速率减半(因此得名“加法增加,乘法减少”)。本质上,AIMD 就像有人说:“再多一点,再多一点,再多一点,哎呀,太多了,减少一点,好吧,再多一点,再多一点……”。因此,它会导致一种称为“TCP 锯齿”的典型带宽形状——稳步上升,然后急剧下降。
At the heart of TCP congestion control is an algorithm called Additive Increase, Multiplicative Decrease, or AIMD. Before AIMD kicks in, a new connection will ramp up its transmission rate aggressively: if the first packet is received successfully it sends out two more, if both of those get through it sends out a batch of four, and so on. But as soon as any packet’s ACK does not come back to the sender, the AIMD algorithm takes over. Under AIMD, any fully received batch of packets causes the number of packets in flight not to double but merely to increase by 1, and dropped packets cause the transmission rate to cut back by half (hence the name Additive Increase, Multiplicative Decrease). Essentially, AIMD takes the form of someone saying, “A little more, a little more, a little more, whoa, too much, cut way back, okay a little more, a little more…” Thus it leads to a characteristic bandwidth shape known as the “TCP sawtooth”—steady upward climbs punctuated by steep drops.
为什么会出现如此急剧且不对称的下降?正如 Jacobson 和 Karels 所解释的,AIMD 首次启动是在连接在其初始快速提升阶段出现第一个丢包时。由于初始阶段每次成功传输时都会将传输速率加倍,因此一旦出现问题,立即将速度减半是完全合理的。而传输过程中,如果再次出现问题,很可能是因为有新的连接在竞争网络。对这种情况最保守的评估——即假设你是唯一使用网络的人,而现在有第二个人占用了一半的资源——也会导致速度减半。这里的保守性至关重要:只有当用户回退的速度至少与网络过载的速度一样快时,网络才能稳定下来。出于同样的原因,仅仅是增加速度有助于稳定所有人的状况,避免快速的过载和恢复循环。
Why such a sharp, asymmetrical decrease? As Jacobson and Karels explain, the first time AIMD kicks in is when a connection has experienced the first dropped packet in its initial aggressive ramping-up phase. Because that initial phase involved doubling the rate of transmission with every successful volley, cutting the speed back by half as soon as there’s been a problem is entirely appropriate. And once a transmission is in progress, if it starts to falter again that’s likely to be because some new connection is competing for the network. The most conservative assessment of that situation—namely, assuming you were the only person using the network and now there’s a second person taking half the resources—also leads to cutting back by half. Conservatism here is essential: a network can stabilize only if its users pull back at least as fast as the rate at which it is being overloaded. For the same reason, a merely additive increase helps stabilize things for everyone, preventing rapid overload-and-recovery cycles.
尽管在自然界中不太可能发现加法和乘法之间如此严格的区别,但 TCP 锯齿确实在各个领域引起了共鸣,在这些领域中,人们的想法是尽可能安全地进行操作。
Though such a strict distinction between addition and multiplication is the kind of thing unlikely to be found in nature, the TCP sawtooth does find resonance in various domains where the idea is to take as much as one can safely get away with.
例如,在2012年的一次偶然合作中,斯坦福大学生态学家黛博拉·戈登和计算机科学家巴拉吉·普拉巴卡发现,蚂蚁似乎比人类早数百万年就发展出了流量控制算法。与计算机网络一样,蚁群在试图管理其“流量”(这里指的是外出觅食的蚂蚁流量)时也面临着分配问题,因为各种条件可能会显著影响蚂蚁成功往返的频率。与互联网上的计算机一样,蚂蚁必须在没有中央决策者的情况下解决这个共同问题,而是发展戈登所说的“无层级控制”。事实证明,蚂蚁的解决方案也类似:一个反馈循环:成功的觅食者促使更多蚂蚁离开巢穴,而返回失败的蚂蚁则导致觅食活动的减少。
In a serendipitous 2012 collaboration, for instance, Stanford ecologist Deborah Gordon and computer scientist Balaji Prabhakar discovered that ants appear to have developed flow control algorithms millions of years before humans did. Like a computer network, an ant colony faces an allocation problem in trying to manage its “flow”—in this case, the flow of ants heading out to forage for food—under variable conditions that may sharply affect the rate at which the ants make successful round-trips. And like computers on the Internet, ants must solve this shared problem without the benefit of a central decision maker, instead developing what Gordon calls “control without hierarchy.” It turns out the ants’ solution is similar, too: a feedback cycle where successful foragers prompt more to leave the nest, while unsuccessful returnees result in a diminishment of foraging activity.
其他动物的行为也与TCP流量控制类似,呈现出锯齿状的特征。追逐人类食物残渣的松鼠和鸽子会一步一步地向前爬行,偶尔跳回来,然后再次稳步向前爬行。人类的通信本身或许也反映了传输它们的协议:每条短信或电子邮件的回复都会鼓励另一条回复,而每条未回复的消息都会阻止流量。
Other animal behavior also evokes TCP flow control, with its characteristic sawtooth. Squirrels and pigeons going after human food scraps will creep forward a step at a time, occasionally leap back, then steadily creep forward again. And it may be that human communications themselves mirror the very protocols that transmit them: every text message or email reply encourages yet another, while every unreturned message stanches the flow.
更广泛地说,AIMD 提出了一种方法,用于解决我们在生活中许多难以在不确定和波动的条件下分配有限资源的问题。
More broadly, AIMD suggests an approach to the many places in life where we struggle to allocate limited resources in uncertain and fluctuating conditions.
教育学教授劳伦斯·J·彼得(Laurence J. Peter)在20世纪60年代提出了一个颇具讽刺意味的“彼得原理”,认为“每个员工都会升职到与其能力不符的水平”。该原理认为,在一个等级森严的组织中,任何能够出色完成工作的人都会获得晋升,获得晋升到新职位的奖励,而新职位可能面临更复杂和/或不同的挑战。当员工最终在一个职位上表现不佳时,他们的晋升之路就会停滞,并且会一直停留在这个职位上度过整个职业生涯。因此,彼得原理的不祥逻辑表明,组织中的每个职位最终都会被一个工作做得不好的人填补。早在彼得原理提出之前大约50年,西班牙哲学家何塞·奥尔特加·加塞特(José Ortega y Gasset)在1910年就表达了同样的观点。他写道:“每个公务员都应该被降职到下一个级别,因为他们在变得无能之前一直处于晋升阶段。”
The satirical “Peter Principle,” articulated in the 1960s by education professor Laurence J. Peter, states that “every employee tends to rise to his level of incompetence.” The idea is that in a hierarchical organization, anyone doing a job proficiently will be rewarded with a promotion into a new job that may involve more complex and/or different challenges. When the employee finally reaches a role in which they don’t perform well, their march up the ranks will stall, and they will remain in that role for the rest of their career. Thus it stands to reason, goes the ominous logic of the Peter Principle, that eventually every spot in an organization will come to be filled by someone doing that job badly. Some fifty years before Peter’s formulation, Spanish philosopher José Ortega y Gasset in 1910 voiced the same sentiment. “Every public servant should be demoted to the immediately lower rank,” he wrote, “because they were advanced until they became incompetent.”
一些组织试图通过解雇那些没有晋升机会的员工来弥补“彼得原理”。由著名律师事务所 Cravath, Swaine & Moore 设计的“克拉瓦斯系统”几乎只招聘应届毕业生,将他们安排在最底层,然后在接下来的几年里例行提拔或解雇他们。1980 年,美国武装部队在《国防军官人事管理法》中采用了类似的“晋升或离职”政策。英国也推行了所谓的“人员控制”,引发了巨大争议。
Some organizations have attempted to remediate the Peter Principle by simply firing employees who don’t advance. The so-called Cravath System, devised by leading law firm Cravath, Swaine & Moore, involves hiring almost exclusively recent graduates, placing them into the bottom ranks, and then routinely either promoting or firing them over the following years. In 1980, the US Armed Forces adopted a similar “up or out” policy with the Defense Officer Personnel Management Act. The United Kingdom has likewise pursued what they call “manning control,” to great controversy.
在“彼得原理”的制度停滞和“晋升或淘汰”制度的严酷之间,是否存在其他选择,是否存在中间道路?AIMD 算法恰好能够提供这样的方法,因为它的设计初衷就是为了应对瞬息万变的环境需求。计算机网络必须管理自身的最大传输容量,以及客户端的传输速率,而所有这些都可能不可预测地波动。同样,在商业环境中,公司用于支付运营费用的资金池是有限的,每个员工或供应商能够完成的工作量和承担的责任也是有限的。每个人的需求、能力和合作关系总是在不断变化。
Is there any alternative, any middle path between the institutional stagnation of the Peter Principle and the draconian severity of the “up or out” system? The AIMD algorithm can offer just such an approach, since it is explicitly designed to handle the demands of a volatile environment. A computer network must manage its own maximum transmission capacity, plus the transmission rates of its clients, all of which may be fluctuating unpredictably. Likewise, in a business setting, a company has a limited pool of funds to pay for its operations, and each worker or vendor has a limited capacity for the amount of work they can do and the amount of responsibility they can handle. Everyone’s needs, capacities, and partnerships are always in flux.
TCP锯齿状曲线的教训是,在不可预测且不断变化的环境中,将事情推向失败的边缘有时确实是充分利用所有资源的最佳(或唯一)方法。重要的是确保对失败的响应既敏锐又有韧性。在AIMD模式下,每个未发生故障的连接都会加速,直到发生故障——然后将其减半,然后立即再次加速。尽管这几乎违背了当前企业文化的所有规范,但我们可以想象,在一家公司里,每年每位员工要么在组织结构图中晋升一级,要么降级一部分。
The lesson of the TCP sawtooth is that in an unpredictable and changing environment, pushing things to the point of failure is indeed sometimes the best (or the only) way to use all the resources to their fullest. What matters is making sure that the response to failure is both sharp and resilient. Under AIMD, every connection that isn’t dropping the ball is accelerated until it is—and then it’s cut in half, and immediately begins accelerating again. And though it would violate almost every norm of current corporate culture, one can imagine a corporation in which, annually, every employee is always either promoted a single step up the org chart or sent part of the way back down.
正如劳伦斯·J·彼得所言,阴险的彼得原理之所以在企业中出现,是因为“层级结构的第一条戒律:必须维护层级结构”。相比之下,TCP 则倡导灵活性的美德。公司谈论“扁平”层级结构和“高层”层级结构,但他们或许会考虑动态层级结构。在 AIMD 系统下,没有人会长期担心负担过重,也不会长期怨恨错过晋升机会;两者都是暂时且频繁的纠正措施,尽管一切都在不断变化,但系统始终徘徊在平衡点附近。或许有一天,我们谈论的不再是职业生涯的弧线,而是它的锯齿状。
As Laurence J. Peter saw it, the insidious Peter Principle arises in corporations because of “the first commandment of hierarchical life: the hierarchy must be preserved.” TCP, in contrast, teaches the virtues of flexibility. Companies speak of “flat” hierarchies and “tall” hierarchies, but they might consider speaking of dynamic ones. Under an AIMD system, no one is long anxious about being overtaxed, nor long resentful about a missed promotion; both are temporary and frequent correctives, and the system hovers near its equilibrium despite everything changing all the time. Perhaps one day we’ll speak not of the arc of one’s career, but rather of its sawtooth.
反向通道:语言学中的流控制
Backchannels: Flow Control in Linguistics
深入研究网络流量控制机制,我们可以清楚地发现,上游的 ACK 数据包不仅用于确认传输,还塑造了整个交互的轮廓、速度和节奏。这不仅提醒我们,也让我们深刻认识到反馈对于通信的重要性。正如我们所见,在 TCP 中,不存在单向传输:如果没有持续的反馈,发送方的速度几乎会立即减慢。
Looking into networking’s flow control makes it clear that upstream ACK packets not only acknowledge and confirm transmissions, but shape the contours of the entire interaction, its pace and cadence. This offers us both a reminder and an insight into how important feedback is to communication. In TCP, as we’ve seen, there’s no such thing as a one-way transmission: without consistent feedback, the sender will slow down almost immediately.
有趣的是,人们日益意识到反馈在网络领域的关键作用,这与语言学界同期发生的一系列几乎相同的发展相呼应。20世纪中叶,语言学界以诺姆·乔姆斯基的理论为主导,该理论认为语言处于最完美、最理想的状态——完美流畅、语法正确、句子不间断,仿佛所有交流都是书面文本。但从20世纪60年代和70年代开始,人们对口语实践方面的兴趣激增,揭示了控制话轮转换、打断以及即时构建句子或故事的过程是多么复杂和微妙,同时还要时刻关注听众的反应。由此产生的是一种愿景,即使表面上的单向沟通也是一种协作行为。正如语言学家维克多·英格韦(Victor Yngve)在1970年所写:“事实上,轮到说话的人和他的同伴同时在说和听。这是因为我所说的‘反向通道’的存在,通过这个通道,轮到说话的人可以接收诸如‘是’和‘嗯’之类的简短信息,而无需放弃发言权。”
Curiously, the rising awareness of the critical role of feedback in the field of networking mirrored an almost identical set of developments going on around the same time in the linguistics community. In the middle of the twentieth century, linguistics was dominated by the theories of Noam Chomsky, which considered language in its most perfect and ideal state—perfectly fluent, grammatical, uninterrupted sentences, as if all communication were written text. But starting in the 1960s and ’70s, a surge of interest in the practical aspects of spoken language revealed just how elaborate and subtle the processes are that govern turn-taking, interruption, and composing a sentence or story on the fly while being attuned to a listener’s reactions every step of the way. What emerged was a vision of even ostensibly one-way communication as a collaborative act. As linguist Victor Yngve would write in 1970, “In fact, both the person who has the turn and his partner are simultaneously engaged in both speaking and listening. This is because of the existence of what I call the back channel, over which the person who has the turn receives short messages such as ‘yes’ and ‘uh-huh’ without relinquishing the turn.”
对人类“秘密渠道”的研究为语言学领域开辟了全新的视野,促使人们重新审视沟通的动态——特别是倾听者的角色。在一项说明性研究中,维多利亚大学的珍妮特·巴维拉斯领导的团队调查了当一个人在听个人故事时分心会发生什么:不是听众的理解力会受到影响,而是故事本身会受到影响。他们发现,如果反馈不佳,故事就会支离破碎。
An examination of human “backchannels” opened a whole new horizon for the field of linguistics, prompting a complete re-evaluation of the dynamics of communication—specifically, the role of the listener. In one illustrative study, a team led by Janet Bavelas at the University of Victoria investigated what would happen when someone listening to a personal story got distracted: not what would happen to the listener’s comprehension, but what would happen to the story. With poor feedback, they discovered, the story falls apart.
那些向心不在焉的听众讲述惊险故事的叙述者……整体上讲得不太好,尤其是在本应戏剧性的结局部分,他们的讲解显得尤为糟糕。他们的故事结局突兀或不连贯,或者兜圈子反复讲述结局,而且他们经常用解释那些显而易见的惊险故事来为自己的故事辩护。
Narrators who told close-call stories to distracted listeners … told them less well overall and particularly poorly at what should have been the dramatic conclusion. Their story endings were abrupt or choppy, or they circled around and retold the ending more than once, and they often justified their story by explaining the obvious close call.
我们都有过这样的经历:和别人聊天时,对方的目光飘忽不定——也许是在看手机——这让我们不禁怀疑,是不是我们讲故事的方式太差了。事实上,现在我们很清楚,原因和结果往往恰恰相反:糟糕的倾听者会毁掉整个故事。
We’ve all had the experience of talking to someone whose eyes drifted away—to their phone, perhaps—making us wonder whether our lackluster storytelling was to blame. In fact, it’s now clear that the cause and effect are often the reverse: a poor listener destroys the tale.
理解人类反向信道的确切功能和意义一直是研究的热点。例如,2014年,加州大学圣克鲁兹分校的杰克逊·托林斯和吉恩·福克斯·特里证明,那些在我们讲话中不显眼的“嗯哼”、“是啊”、“嗯”和“哦”在调节信息从说话者到听众的流动速度和细节程度方面发挥着独特而精确的作用。事实上,它们的重要性丝毫不亚于TCP中的ACK。托林斯说:“说真的,虽然有些人可能比其他人更糟糕,但‘讲故事不流利的人’至少可以部分地怪罪他们的听众。” 这种认识带来了意想不到的副作用,减轻了他讲课时的一些压力——当然,包括关于这个结果的讲座。“每当我做这些反向信道演讲时,我总是告诉听众,他们现在反向信道的方式正在改变我的演讲内容,”他开玩笑说,“所以他们要为我的演讲负责。”
Understanding the exact function and meaning of human backchannels continues to be an active area of research. In 2014, for instance, UC Santa Cruz’s Jackson Tolins and Jean Fox Tree demonstrated that those inconspicuous “uh-huhs” and “yeahs” and “hmms” and “ohs” that pepper our speech perform distinct, precise roles in regulating the flow of information from speaker to listener—both its rate and level of detail. Indeed, they are every bit as critical as ACKs are in TCP. Says Tolins, “Really, while some people may be worse than others, ‘bad storytellers’ can at least partly blame their audience.” This realization has had the unexpected side effect of taking off some of the pressure when he gives lectures—including, of course, lectures about that very result. “Whenever I give these backchannel talks, I always tell the audience that the way they are backchanneling to my talk right now is changing what I say,” he jokes, “so they’re responsible for how well I do.”
Bufferbloat:愚蠢的,这就是延迟
Bufferbloat: It’s the Latency, Stupid
由于对排队的原因和意义存在误解,有效的主动排队管理的开发受到了阻碍。
Developing effective active queue management has been hampered by misconceptions about the cause and meaning of queues.
—凯瑟琳·尼科尔斯和范·雅各布森
—KATHLEEN NICHOLS AND VAN JACOBSON
那是2010年的夏天,和许多家长一样,吉姆·盖蒂斯(Jim Gettys)经常接到孩子们的抱怨,说家里的Wi-Fi网络速度太慢。不过,与大多数家长不同的是,盖蒂斯曾在惠普、阿尔卡特朗讯、万维网联盟和互联网工程任务组(Internet Engineering Task Force)工作过。1999年,他正是HTTP规范的编辑,该规范至今仍在使用。所以,大多数“极客爸爸”会去研究这个问题,而盖蒂斯却去研究这个问题。
It was the summer of 2010, and like many parents, Jim Gettys was fielding frequent complaints from his children that the family wi-fi network was running slowly. Unlike most parents, though, Gettys has worked at HP, Alcatel-Lucent, the World Wide Web Consortium, and the Internet Engineering Task Force. He was literally the editor, in 1999, of the HTTP specification still in use today. So where most geek dads would look into the problem, Gettys looked into the problem.
正如盖蒂斯向一屋子的谷歌工程师解释的那样,他的网络术语让位于一种紧迫而明确的信念:
As Gettys would explain to a roomful of Google engineers, with networking jargon giving way to an urgent and unmistakable conviction:
我当时正通过这条十毫秒长的路径,从家里复制(或者说是rsync)旧的X联盟档案到麻省理工学院……SmokePing报告说,就在复制文件时,平均延迟超过一秒,并且还伴有严重的数据包丢失……我用Wireshark测试了一下,发现出现了一些非常奇怪的行为……这看起来根本不像我预想的TCP锯齿波。这种事绝对不应该发生。
I happened to be copying, or rsyncing, the old X Consortium archives from my house to MIT over this ten-millisecond-long path.… SmokePing [was] reporting latencies averaging well over one second, along with bad packet loss, just while copying a file.… I took Wireshark, and there were these bursts of really strange behavior.… This looked like no TCP [sawtooth] I expected at all. It should never occur that way.
用通俗的话说,他看到了一些……非常奇怪的东西。俗话说:“科学界最激动人心的、预示着新发现的短语,不是‘我发现了!’而是‘真有趣!’。”
In plain English, he saw something … very weird. As the saying goes, “the most exciting phrase to hear in science, the one that heralds new discoveries, is not ‘Eureka!’ but ‘That’s funny.’”
起初,盖蒂斯以为是他的电缆调制解调器出了问题。他家人一直说是互联网出了问题,但实际上,问题似乎出在他们家墙上的插座上。原本应该发往波士顿的数据包并没有卡在半路上,而是卡在了家里。
At first Gettys thought that something was wrong with his cable modem. What his family had been calling a problem in the Internet seemed like a traffic jam at their own wall socket. Packets meant for Boston weren’t getting stuck midway there; they were getting stuck in the house.
但盖蒂斯研究得越深入,就越担心。问题不仅仅影响了他家的路由器和调制解调器,而是影响了家里所有的路由器和调制解调器。问题也不仅仅存在于网络设备上——它存在于电脑本身,包括台式机、笔记本电脑、平板电脑和智能手机,以及Linux、Windows和OS X操作系统。问题也不仅仅存在于终端用户硬件上:它触及了互联网本身的基础设施。盖蒂斯与康卡斯特、Verizon、思科和谷歌的关键人物共进午餐,其中包括范·雅各布森和温特·瑟夫,并开始慢慢地将谜团拼凑起来。
But the deeper Gettys looked into it, the more concerned he grew. The problem didn’t affect just his home router and modem, but every home router and modem. And the problem wasn’t just in networking devices—it was in computers themselves, in desktops, laptops, tablets, and smartphones, woven into Linux, Windows, and OS X. And it wasn’t just in end-user hardware, either: it touched the very infrastructure of the Internet itself. Gettys sat down to lunches with key players at Comcast, Verizon, Cisco, and Google, including Van Jacobson and Vint Cerf, and slowly started to piece the puzzle together.
问题无处不在,而问题就是缓冲区膨胀。
The problem was everywhere. And the problem was bufferbloat.
缓冲区本质上是一个队列,其功能是平滑突发事件。如果你和另一位顾客几乎同时走进一家甜甜圈店,那么一时不知所措的收银员不会让你们中的一个人离开商店,下次再来。顾客当然不会接受,管理层也不会:这样的政策几乎肯定会导致收银员的利用率不足。相反,让顾客排队可以确保商店的平均吞吐量接近其最大吞吐量。这是一件好事。
A buffer is essentially a queue whose function is to smooth out bursts. If you walked into a doughnut shop at roughly the same time as another customer, it wouldn’t do for the very momentarily overwhelmed cashier to make one of you leave the store and come back another time. Customers wouldn’t have it, of course, but neither would management: such a policy is virtually guaranteed to underutilize the cashier. Putting the customers in a queue instead ensures that the average throughput of the store approaches its maximum throughput. That’s a good thing.
然而,这种卓越的资源利用率也带来了一个非常现实的代价:延迟。汤姆带女儿去伯克利参加五月五日节时,女儿一心想吃巧克力香蕉可丽饼,于是他们就排队等候。最终,20分钟后,汤姆排到了队伍最前面并下了单。但付款后,他们又不得不再等40分钟才能拿到可丽饼。(就像吉姆·盖蒂斯一样,汤姆很快发现自己要应对大量的家庭投诉。)结果发现,接单所花的时间比做可丽饼要少,所以排队点单只是问题的第一部分。不过,至少它是看得见的;顾客们知道自己要等什么。第二条更长的队伍是看不见的。所以在这种情况下,如果可丽饼摊位能够在某个时候切断队伍,并挂出一个标志,表明他们暂时不接单,那么对所有人都会是一个更令人满意的结果。拒绝顾客对每个人都有好处——无论他们最终排队买可丽饼的队伍变短了,还是去了别处。而且可丽饼摊也不会损失一分钱的销售额,因为无论顾客等了多久,他们一天只能卖出自己能做的可丽饼。
This superior resource utilization comes with a very real cost, however: delay. When Tom took his daughter to a Cinco de Mayo festival in Berkeley, she set her heart on a chocolate banana crêpe, so they got in line and waited. Eventually—after twenty minutes—Tom got to the front of the line and placed his order. But after paying, they then had to wait forty more minutes to actually get the crêpe. (Like Jim Gettys, Tom quickly found himself fielding a substantial volume of familial complaints.) Taking orders turned out to take less time than making crêpes, so the queue to order was just the first part of the problem. At least it was visible, though; customers knew what they were in for. The second, longer queue was invisible. So in this case it would have been a much happier outcome for all if the crêpe stand had just cut off the line at some point and put up a sign that they weren’t taking orders for a bit. Turning customers away would have made everyone better off—whether they ended up in a shorter crêpe line or went elsewhere. And wouldn’t have cost the crêpe stand a dime of lost sales, because either way they can only sell as many crêpes as they can make in a day, regardless of how long their customers are waiting.
这正是吉姆·盖茨(Jim Gettys)在他家的有线调制解调器上观察到的现象。因为他正在上传文件,他的电脑会向调制解调器发送尽可能多的上行数据包。而调制解调器会假装处理比实际能力多得多的数据包,在建立庞大的队列的同时,不拒绝任何数据包。因此,当盖茨试图同时下载某些内容(例如访问网页或查看电子邮件)时,他的确认数据包会卡在上传数据包后面,不得不在调制解调器前排队等待才能离开家。由于他的确认数据包需要很长时间才能返回到网络和电子邮件服务器,这些服务器会相应地限制自身的下行连接速度,使其变得非常缓慢。
This is precisely the phenomenon that Jim Gettys was observing in his home cable modem. Because he was uploading a file, his computer was sending the modem as many upstream packets as it could handle. And the modem was pretending to handle a lot more than it actually could, turning none away while building up a massive queue. So when Gettys tried to download something at the same time—to visit a webpage or check email—his ACK packets would get stuck behind the upload, having to wait in line at the modem to leave the house. Because his ACKs then took forever to return to the web and email servers, the servers would in turn throttle their own downstream connection speeds to a corresponding crawl.
这就像在对话中,你每次说“嗯哼”就会延迟十几秒或二十秒。说话的人会以为你没听懂,所以语速会慢下来,而你对此却无能为力。
It was like trying to have a conversation where every time you say “uh-huh” it is delayed by ten or twenty seconds. The speaker is going to slow way down, assuming you aren’t comprehending them, and there’s nothing you can do about it.
当网络缓冲区满时,通常会发生一种被称为“尾部丢弃”的情况:一种毫不客气的说法,就是所有在该点之后到达的数据包都会被直接拒绝,并被有效地删除。(如果排队太长,就拒绝新顾客光顾可丽饼摊,这在人类语境中就是“尾部丢弃”的一种表现形式。)以邮政来比喻数据包交换,想象邮递员会把当天早上装不下卡车的每一个包裹都“蒸发”掉,这似乎有点奇怪。然而,正是这种“数据包丢弃”导致计算机注意到其中一个数据包尚未被确认,从而促使 AIMD 开始将带宽减半。丢弃的数据包是互联网的主要反馈机制。缓冲区过大——餐厅无论厨房人手多么短缺都会接受所有订单,调制解调器无论发送数据包需要多长时间都会接收所有传入的数据包——都会阻止这种适度的机制正常进行。
When a networking buffer fills up, what typically happens is called Tail Drop: an unceremonious way of saying that every packet arriving after that point is simply rejected, and effectively deleted. (Turning new customers away from the crêpe stand once the line gets too long would be a version of Tail Drop in a human context.) Given the postal metaphor for packet switching, it might seem a bit odd to imagine a mail carrier who simply vaporizes every parcel that doesn’t fit onto the truck that morning. Yet it’s precisely such “packet drops” that lead a computer to notice that one of its packets hasn’t been acknowledged, prompting AIMD to start halving the bandwidth. Dropped packets are the Internet’s primary feedback mechanism. A buffer that’s too large—a restaurant taking every order no matter how short-staffed the kitchen, a modem taking every packet that comes in regardless of how long it’ll take to send them on—prevents this moderation from happening as it should.
从根本上讲,缓冲区利用延迟(在网络中称为“等待时间”)来最大化吞吐量。也就是说,它们会让数据包(或客户)等待,以利用稍后速度较慢的时段。但是,如果缓冲区一直处于满负荷状态,则会给您带来两种最糟糕的结果:全是延迟,却没有任何好处。如果您平均清除数据的速度至少与数据到达的速度一样快,那么平滑突发流量固然很好,但如果您的平均工作量超过了平均工作率,那么任何缓冲区都无法创造奇迹。缓冲区越大,在您开始发出求救信号之前,您就会落后得越远。缓冲区的基本原则之一(无论是用于数据包还是用于顾客)是,它们只有在定期清零时才能正常工作。
Fundamentally, buffers use delay—known in networking as “latency”—in order to maximize throughput. That is, they cause packets (or customers) to wait, to take advantage of later periods when things are slow. But a buffer that’s operating permanently full gives you the worst of both worlds: all the latency and none of the give. Smoothing out bursts is great if you are, on average, clearing things at least as quickly as they’re arriving—but if your average workload exceeds your average work rate, no buffer can work miracles. And the bigger the buffer is, the further behind you’ll get before you start signaling for help. One of the fundamental principles of buffers, be they for packets or patrons, is that they only work correctly when they are routinely zeroed out.
几十年来,计算机内存价格昂贵,根本没有理由构建拥有大量不必要内存容量的调制解调器。因此,调制解调器根本无法构建超出其处理能力的队列。但到了某个时候,随着计算机行业的规模经济大幅降低内存成本,调制解调器制造商开始为其设备提供千兆字节的内存,因为这实际上是他们能获得的最小内存容量。结果,无处不在的设备缓冲区——在调制解调器、路由器、笔记本电脑、智能手机以及互联网主干网中——变得比以往大了数千倍,直到像吉姆·盖蒂斯这样的人敲响警钟,采取措施解决这个问题。
For decades, computer memory was sufficiently expensive that there was simply no reason to build modems with oodles of unnecessary memory capacity. Thus, there had simply been no way for a modem to build up a queue bigger than it could handle. But at some point, as economies of scale in the computer industry radically lowered the cost of memory, modem manufacturers started giving their machines gigabytes of RAM because that was effectively the smallest amount of RAM they could get. As a result, the ubiquitous device buffers—in modems, routers, laptops, smartphones, and in the backbone of the Internet itself—became thousands of times too big, before people like Jim Gettys sounded the alarm to do something about it.
迟到总比不早到好
Better Never than Late
就拿你单身最基本的毛病来说吧……有人喜欢你,你却不喜欢。以前,那种情况挺尴尬的。你得找人聊聊,感觉怪怪的。现在怎么办?有人喜欢你,你却不喜欢?那就装作很忙的样子……永远这样。
Take your most basic problem as a single person … someone likes you, you don’t like them back. At one point, that used to be kind of an awkward situation. You had to have a conversation, it was weird. Now what do you do? Someone likes you, you don’t like them back? You just pretend to be busy … forever.
—阿齐兹·安萨里
—AZIZ ANSARI
现在总比没有好。
Now is better than never.
尽管从来没有比现在更好。
Although never is often better than right now.
— Python 之禅
—THE ZEN OF PYTHON
歌手凯蒂·佩里 (Katy Perry) 的 Twitter 粉丝数量比她家乡加利福尼亚州的人口总数多 107%。作为 Twitter 上粉丝最多的人,截至 2016 年初,她的粉丝账户数量约为 8120 万。这意味着,即使 99% 的粉丝从未给她发过消息——即使那 1% 最忠实的粉丝每年只给她发一次消息——她每天仍然会收到 2225 条消息。天天如此。
Singer Katy Perry has 107% more Twitter followers than her home state of California has people. The most-followed person on Twitter, as of early 2016 she counts some 81.2 million accounts among her fans. This means that even if 99% of her fans never message her at all—and even if that most devoted 1% who message her do so only once per year—then she still gets 2,225 messages a day. Every single day.
想象一下,如果佩里承诺按照收到的顺序回复每一条粉丝留言。如果她每天能回复100条,那么粉丝们等待回复的预期时间很快就会以几十年来计算。可以想象,大多数粉丝宁愿选择即使只有微弱的几率也能立即收到回复,也不愿在十年或二十年后得到保证的回复。
Imagine if Perry were committed to answering each fan message in the order received. If she could reply to 100 a day, then the fans’ expected wait time for a response would soon be measured in decades. It’s fair to imagine that most fans would prefer a slim chance of getting a reply right away to a guaranteed reply ten or twenty years hence.
请注意,佩里在离开演出场地时,不必担心这个问题,她必须穿过一群期待签名或几句话的粉丝的夹道欢迎。佩里尽力而为,继续前进,失去的机会也就随之消散了。身体本身就是流量控制机制。我们无法同时出现在多个地方。在拥挤的派对上,我们参与的对话不可避免地不到5%,也无法阅读或了解剩余的内容。错过视网膜的光子不会被排队等待稍后查看。在现实生活中,数据包几乎完全丢失。
Note that Perry doesn’t have this problem when she leaves a venue and must run a gauntlet of fans expecting an autograph or a few words. Perry does what she can, moves on, and the lost opportunities dissipate. The body is its own flow control. We can’t be in more than one place at one time. At a crowded party we inevitably participate in less than 5% of the conversation, and cannot read up or catch up on the remainder. Photons that miss the retina aren’t queued for later viewing. In real life, packet loss is almost total.
我们用“丢球”这个成语几乎完全是贬义的,指某人懒惰、自满或健忘。但巧妙地丢球,对于在超负荷的情况下完成工作至关重要。
We use the idiom of “dropped balls” almost exclusively in a derogatory sense, implying that the person in question was lazy, complacent, or forgetful. But the tactical dropping of balls is a critical part of getting things done under overload.
对现代通信最普遍的批评是,我们“始终处于连接状态”。但问题不在于我们始终处于连接状态;我们并非如此。问题在于我们始终处于缓冲状态。这其中的差别是巨大的。
The most prevalent critique of modern communications is that we are “always connected.” But the problem isn’t that we’re always connected; we’re not. The problem is that we’re always buffered. The difference is enormous.
那种需要浏览互联网上所有东西、读遍所有书籍、看遍所有节目的感觉,就是缓冲膨胀。你错过了最喜欢的电视剧的一集,然后过了一小时、一天,甚至十年才看。你去度假,回家后发现堆积如山的信件。以前,人们敲你的门,无人回应,然后就走开了。现在,当你回家时,他们实际上正在排队等候。
The feeling that one needs to look at everything on the Internet, or read all possible books, or see all possible shows, is bufferbloat. You miss an episode of your favorite series and watch it an hour, a day, a decade later. You go on vacation and come home to a mountain of correspondence. It used to be that people knocked on your door, got no response, and went away. Now they’re effectively waiting in line when you come home.
哎呀,电子邮件的设计初衷就是为了克服“尾部丢弃”问题。正如它的发明者雷·汤姆林森所说:
Heck, email was deliberately designed to overcome Tail Drop. As its inventor, Ray Tomlinson, puts it:
当时,几乎没有什么好办法可以给别人留言。电话在一定程度上还能用,但必须有人接听。如果接电话的人不是你想接的人,那就得找行政助理、电话答录机之类的。留言就得通过这种机制,所以大家都抱着电脑留言的想法。
At the time there was no really good way to leave messages for people. The telephone worked up to a point, but someone had to be there to receive the call. And if it wasn’t the person you wanted to get, it was an administrative assistant or an answering service or something of that sort. That was the mechanism you had to go through to leave a message, so everyone latched onto the idea that you could leave messages on the computer.
换句话说,我们要求一个永远不会拒绝发送者的系统,无论好坏,我们都得到了一个。事实上,在过去的十五年里,从电路交换到分组交换的转变已经在整个社会中得到了体现。我们过去常常与他人请求专用电路;现在我们向他们发送数据包,并满怀期待地等待确认。我们过去常常拒绝;现在我们推迟。
In other words, we asked for a system that would never turn a sender away, and for better or worse we got one. Indeed, over the past fifteen years, the move from circuit switching to packet switching has played itself out across society. We used to request dedicated circuits with others; now we send them packets and wait expectantly for ACKs. We used to reject; now we defer.
人们常说的“没有空闲时间”恰恰是缓冲区的主要特性:将平均吞吐量提升到峰值吞吐量。缓冲区的作用就是防止空闲时间。你可以在路上、度假时、上厕所时、半夜查看邮件。你永远不会感到无聊。这正是缓冲区的一大优点,正如它宣传的那样。
The much-lamented “lack of idleness” one reads about is, perversely, the primary feature of buffers: to bring average throughput up to peak throughput. Preventing idleness is what they do. You check email from the road, from vacation, on the toilet, in the middle of the night. You are never, ever bored. This is the mixed blessing of buffers, operating as advertised.
休假邮件自动回复程序会明确告知发件人预计会有延迟;更好的方案或许会告知发件人预计会出现尾部丢弃的情况。与其提醒发件人队列时间超过平均水平,不如提醒他们它正在拒绝所有来信。而且这不仅限于休假:可以想象,一个邮件程序被设置为在收件箱达到(比如)一百封邮件后自动拒绝所有来信。对于账单之类的邮件来说,这种做法并不明智,但对于社交邀请之类的邮件来说,这并非不合理的做法。
Vacation email autoresponders explicitly tell senders to expect latency; a better one might instead tell senders to expect Tail Drop. Rather than warning senders of above-average queue times, it might warn them that it was simply rejecting all incoming messages. And this doesn’t need to be limited to vacations: one can imagine an email program set to auto-reject all incoming messages once the inbox reached, say, a hundred items. This is ill-advised for bills and the like, but not an unreasonable approach to, say, social invitations.
如今,遇到“满”的收件箱或“满”的语音邮件这种想法已经过时了,明显是倒退回了20世纪末和21世纪初的时代。但是,如果连接我们新潮手机和电脑的网络,拥有几乎无限的存储空间,却仍然在流量激增时故意丢弃数据包,那么或许我们有理由认为“尾部丢弃”并非内存空间有限造成的可悲后果,而是一种有目的的策略。
The idea of encountering a “full” inbox or “full” voicemail is an anachronism now, a glaring throwback to the late twentieth century and the early 2000s. But if the networks that connect our newfangled phones and computers, with their effectively infinite storage, are still deliberately dropping packets when things get fast and furious, then maybe there’s reason to think of Tail Drop not as the lamentable consequence of limited memory space but as a purposeful strategy in its own right.
至于网络缓冲区膨胀,目前进展复杂却令人欣喜,硬件和操作系统制造商正在大力努力,对网络队列进行根本性的变革。此外,还有一项关于 TCP 的新反向通道的提案,这是多年来首次出现此类修改:显式拥塞通知 (ECN)。彻底解决互联网的缓冲区膨胀问题需要所有这些改进,并且需要多年的耐心。“这将是一场旷日持久的泥沼,”Gettys 说。
As for network bufferbloat, the ongoing story is a complicated but happy one, involving large-scale efforts by hardware and operating system manufacturers to make fundamental changes to network queues. There’s also a proposal for a new backchannel for TCP, the first such modification in many years: Explicit Congestion Notification, or ECN. Fully extricating the Internet from bufferbloat will draw on all of these changes and require the patience of many years. “This is a long-term swamp,” says Gettys.
但是,后缓冲区膨胀时代仍有很多值得期待的地方。由于缓冲区本身存在延迟,它不利于大多数交互过程。例如,当我们通过 Skype 通话时,我们通常更喜欢现在偶尔出现静电干扰的信号,而不是清晰地记录对方三秒前说的话。对于游戏玩家来说,即使是 50 毫秒的延迟也可能决定胜负;事实上,游戏对延迟非常敏感,以至于所有重要的游戏荣誉仍然需要线下争夺,玩家们甚至会登上飞机,聚集在一起,通过一个只服务于一个房间的网络进行比赛。对于其他任何需要同步性的事情来说,情况也大体如此。“如果你想和朋友们一起玩音乐,即使是在[你的]大都市里,你也会在意几十毫秒,”Gettys 说道,他设想着一大批新的应用程序和企业可能会涌现,利用低延迟带来的交互潜力。“我从这段经历中得出的一个普遍结论是,工程师应该把时间视为一等公民。”
But there’s a lot to look forward to about a post-bufferbloat future. With their inherent latency, buffers are bad for most interactive processes. When we speak via Skype, for example, we generally prefer an occasionally staticky signal now to a clear recording of what our caller said three seconds ago. For gamers, even a 50-millisecond lag could be the difference between fragging and being fragged; in fact, gaming is so sensitive to latency that all important gaming honors are still contested in person, with players boarding airplanes to gather and compete over a network serving just a single room. And much the same is true for anything else where being in sync matters. “If you want to play music with your friends, even in [your] metropolitan area, you care about tens of milliseconds,” Gettys notes, imagining a whole host of new applications and businesses that might spring forth to take advantage of the interactive potential of low latencies. “A generalization I take away from this whole experience is that engineers should think about time as a first-class citizen.”
苹果公司的斯图尔特·切希尔(Stuart Cheshire)也认为,现在是时候让延迟成为网络工程师的首要任务了。他震惊地发现,那些宣传“快速”互联网连接的公司只指高带宽,而不是低延迟。他打个比方,波音737和波音747的飞行速度都约为每小时500英里;前者可搭载120名乘客,而后者的载客量是后者的三倍。所以,“你会说波音747比波音737‘快’三倍吗?当然不会,”切希尔惊呼道。容量有时确实很重要:对于传输大文件,带宽是关键。(如果你要运输大量货物,集装箱船的运输能力可能远胜于波音747的数千趟航班。)然而,对于人际应用而言,快速的周转时间往往更为重要,而我们真正需要的是更多的协和式飞机。事实上,降低延迟是当前网络研究的前沿之一,看看它会带来什么结果将会很有趣。
Apple’s Stuart Cheshire concurs that it’s high time for latency to become a top priority for network engineers. He’s appalled that companies who advertise “fast” Internet connections refer only to high bandwidth, not to low delay. By analogy, he notes that a Boeing 737 and a Boeing 747 both fly at about five hundred miles per hour; the former can hold 120 passengers, while the latter carries three times as many. So “would you say that a Boeing 747 is three times ‘faster’ than a Boeing 737? Of course not,” Cheshire exclaims. Capacity does matter sometimes: for transferring large files, bandwidth is key. (If you’ve got a huge amount of cargo to move, a container ship may well trump thousands of trips by a 747.) For interhuman applications, however, a quick turnaround time is often far more important, and what we really need are more Concordes. And indeed, bringing latencies down is one of the current frontiers of networking research, and it will be interesting to see what that brings.
与此同时,还有其他战斗要打。盖蒂斯的注意力瞬间移开,望向画面外。“你这边不行吗?我现在正在和人沟通,等我忙完再处理。我们这边就到此为止了——呃,不行,5GHz 频段现在还能用,2.4GHz 频段卡住了。是那个臭名昭著的 bug。我去重启路由器。”这似乎是一个绝佳的时机,让我们告别,把带宽释放给大众,释放给那些不断增加流量的无数数据流。
Meanwhile, there are other battles to be waged. Gettys snaps his attention away for a second, looking out of the frame. “It’s not working for you? I’m talking to someone at the moment, and I’ll deal with it when I’m finished. We’re wrapping up here—uh, no, the 5 GHz is working at the moment, the 2.4 GHz channel has hung. It’s the infamous bug. I’ll reboot the router.” Which seems an opportune moment to say our good-byes and release our bandwidth to the commons, to the myriad flows making their additive increase.
我是一个乐观主义者,因为我相信人类是高尚和可敬的,其中一些人真的很聪明……我对群体中的人持更悲观的看法。
I’m an optimist in the sense that I believe humans are noble and honorable, and some of them are really smart.… I have a somewhat more pessimistic view of people in groups.
—史蒂夫·乔布斯
—STEVE JOBS
一位投资者将股票卖给另一位投资者,一位确信股票会下跌,而另一位确信股票会上涨;我想我知道你在想什么,但不知道你认为我在想什么;经济泡沫破裂;一位潜在恋人送的礼物既不是“我想成为朋友以上的关系”,也不是“我不想成为朋友以上的关系”;一桌食客为谁该请客以及为什么而争吵;有人想帮忙,却无意中冒犯了别人;有人想保持冷静,却引来窃笑;有人想脱颖而出,却沮丧地发现,其他人也跟着他一起做了。“我爱你”,一个恋人对另一个说;“我也爱你”,另一个回答;两人都想知道对方到底是什么意思。
An investor sells a stock to another, one convinced it’s headed down and the other convinced it’s going up; I think I know what you think but have no idea what you think I think; an economic bubble bursts; a prospective lover offers a gift that says neither “I want to be more than friends” nor “I don’t want to be more than friends”; a table of diners squabbles over who should treat whom and why; someone trying to be helpful unintentionally offends; someone trying hard to be cool draws snickers; someone trying to break from the herd finds, dismayingly, the herd following his lead. “I love you,” says one lover to another; “I love you, too,” the other replies; and both wonder what exactly the other means by that.
计算机科学对于这一切有何看法?
What does computer science have to say about all this?
小学生被教导将文学情节设想为以下几种类型之一:人与自然、人与自我、人与人、人与社会。本书迄今为止主要探讨了前两类案例——也就是说,迄今为止,计算机科学一直是我们解决由世界基本结构以及我们有限的信息处理能力所造成的问题的指南。最优停止问题源于时间的不可逆性和不可撤销性;探索/利用困境源于时间的有限性。松弛和随机化是应对旅行计划和疫苗接种等不可避免的复杂性挑战的重要且必要的策略。
Schoolchildren are taught to conceive of literary plots as belonging to one of several categories: man vs. nature, man vs. self, man vs. man, man vs. society. Thus far in this book we have considered primarily cases in the first two categories—that is to say, computer science has thus far been our guide to problems created by the fundamental structure of the world, and by our limited capacities for processing information. Optimal stopping problems spring from the irreversibility and irrevocability of time; the explore/exploit dilemma, from time’s limited supply. Relaxation and randomization emerge as vital and necessary strategies for dealing with the ineluctable complexity of challenges like trip planning and vaccinations.
在本章中,我们将转移焦点,探讨剩下的两类问题——人与人之间的博弈和人与社会之间的博弈:实际上,它们是我们彼此引发并造成的问题。我们在这个领域的最佳指南来自数学的一个分支——博弈论。该领域的经典版本对20世纪产生了巨大的影响。在过去的几十年里,博弈论与计算机科学的交叉融合催生了算法博弈论领域——它已经开始对21世纪产生影响。
In this chapter we shift the focus and consider the remaining two genres—that is, man vs. man and man vs. society: in effect, the problems that we pose and cause each other. Our best guide to this terrain comes from a branch of mathematics known as game theory, a field that in its classical incarnation had an enormous impact on the twentieth century. In the past couple of decades, cross-pollination between game theory and computer science has produced the field of algorithmic game theory—which has already begun to have an impact on the twenty-first.
递归
Recursion
现在,一个聪明人会把毒药下到自己的酒杯里,因为他知道只有大傻瓜才会伸手去拿别人递给他的东西。我不是个大傻瓜,所以我显然不能选择你面前的酒。但你肯定知道我不是个大傻瓜——你肯定知道——所以我显然不能选择我面前的酒。
Now, a clever man would put the poison into his own goblet because he would know that only a great fool would reach for what he was given. I am not a great fool, so I can clearly not choose the wine in front of you. But you must have known I was not a great fool—you would have counted on it—so I can clearly not choose the wine in front of me.
—公主新娘
—THE PRINCESS BRIDE
约翰·梅纳德·凯恩斯,这位二十世纪最具影响力的经济学家,曾说过:“成功的投资在于预测他人的预期。” 假设一股股票的售价为 60 美元,买家必须相信自己以后能以 70 美元的价格卖给一个相信自己能以 80 美元卖给另一个相信自己能以 90 美元卖给另一个相信自己能以 100 美元卖给其他人的人。这样一来,股票的价值不在于人们认为它值多少钱,而在于人们认为人们认为它值多少钱。事实上,即使这样也还不够。正如凯恩斯在美丽和流行之间做出的关键区分时所说:
Arguably the most influential economist of the twentieth century, John Maynard Keynes, once said that “successful investing is anticipating the anticipations of others.” For a share of stock to be sold at, say, $60, the buyer must believe he can sell it later for $70—to someone who believes he can sell it for $80 to someone who believes he can sell it for $90 to someone who believes he can sell it for $100 to someone else. In this way, the value of a stock isn’t what people think it’s worth but what people think people think it’s worth. In fact, even that’s not going far enough. As Keynes put it, making a crucial distinction between beauty and popularity:
专业投资可以比作报纸上的竞赛,参赛者需要从一百张照片中选出六张最漂亮的脸蛋,奖品将颁发给选择最符合所有参赛者平均偏好的参赛者;因此,每个参赛者选择的不是自己认为最漂亮的脸蛋,而是他认为最有可能吸引其他参赛者注意的脸蛋,因为其他参赛者都从同一个角度看待这个问题。这并不是说要选择那些根据个人判断真正最漂亮的脸蛋,甚至也不是选择那些普遍看法真正认为最漂亮的脸蛋。我们已经达到了第三级,我们将自己的智慧用于预测普遍看法对普遍看法的预期。我相信,有些人会达到第四级、第五级甚至更高的级别。
Professional investment may be likened to those newspaper competitions in which the competitors have to pick out the six prettiest faces from a hundred photographs, the prize being awarded to the competitor whose choice most nearly corresponds to the average preferences of the competitors as a whole; so that each competitor has to pick, not those faces which he himself finds prettiest, but those which he thinks likeliest to catch the fancy of the other competitors, all of whom are looking at the problem from the same point of view. It is not a case of choosing those which, to the best of one’s judgment, are really the prettiest, nor even those which average opinion genuinely thinks the prettiest. We have reached the third degree where we devote our intelligences to anticipating what average opinion expects the average opinion to be. And there are some, I believe who practice the fourth, fifth, and higher degrees.
计算机科学用所谓的“停机问题”阐明了这种推理的根本局限性。正如艾伦·图灵在 1936 年证明的那样,计算机程序永远无法确切地告诉你另一个程序是否会永无止境地计算下去——除非模拟该程序的运行,从而可能最终导致程序自身陷入崩溃。(因此,程序员永远不会拥有可以判断其软件是否会死机的自动化工具。)这是整个计算机科学的基础性成果之一,许多其他证明都基于此。*简而言之,任何时候,一个系统——无论是机器还是思维——模拟自身这样复杂事物的运作,它都会发现自己的资源完全耗尽,这或多或少是理所当然的。计算机科学家用一个术语来描述这种在镜厅中潜藏的永无止境的旅程,思维模拟思维,思维模拟思维:“递归”。
Computer science illustrates the fundamental limitations of this kind of reasoning with what’s called the “halting problem.” As Alan Turing proved in 1936, a computer program can never tell you for sure whether another program might end up calculating forever without end—except by simulating the operation of that program and thus potentially going off the deep end itself. (Accordingly, programmers will never have automated tools that can tell them whether their software will freeze.) This is one of the foundational results in all of computer science, on which many other proofs hang.* Simply put, any time a system—be it a machine or a mind—simulates the workings of something as complex as itself, it finds its resources totally maxed out, more or less by definition. Computer scientists have a term for this potentially endless journey into the hall of mirrors, minds simulating minds simulating minds: “recursion.”
“玩扑克牌时,你永远不要玩自己的牌,”詹姆斯·邦德在《皇家赌场》中说道,“你玩的是坐在你对面的那个人。” 事实上,你真正玩的是一个理论上无限递归的过程。先有你自己的牌,然后你认为对手拥有的牌;然后你认为对手认为你拥有的牌,以及你认为对手认为你认为他拥有的牌……如此循环往复。“我不知道这是否是一个真正的博弈论术语,”世界顶级扑克玩家丹·史密斯说道,“但扑克玩家称之为‘平衡’。第一级是‘我知道’。第二级是‘你知道我知道’。第三级是‘我知道你知道我知道’。有些情况下,你会觉得,‘哇,这是一个非常愚蠢的虚张声势的时机,但如果他知道这是一个愚蠢的虚张声势的时机,他就不会跟注,而这正是一个聪明的虚张声势的时机。’这样的事情确实会发生。”
“In poker, you never play your hand,” James Bond says in Casino Royale; “you play the man across from you.” In fact, what you really play is a theoretically infinite recursion. There’s your own hand and the hand you believe your opponent to have; then the hand you believe your opponent believes you have, and the hand you believe your opponent believes you to believe he has … and on it goes. “I don’t know if this is an actual game-theory term,” says the world’s top-rated poker player, Dan Smith, “but poker players call it ‘leveling.’ Level one is ‘I know.’ Two is ‘you know that I know.’ Three, ‘I know that you know that I know.’ There are situations where it just comes up where you are like, ‘Wow, this is a really silly spot to bluff but if he knows that it is a silly spot to bluff then he won’t call me and that’s where it’s the clever spot to bluff.’ Those things happen.”
高水平扑克中最令人难忘的诈唬之一发生在Tom Dwan用德州扑克最差的一手牌——2-7——下注479,500美元的时候——当时他居然告诉对手Sammy George,他拿着这手牌。“你没有2-7,”George回答道。“你没有2-7。”George弃牌了,而Dwan——没错,就是2-7——拿下了底池。
One of the most memorable bluffs in high-level poker occurred when Tom Dwan wagered $479,500 on Texas Hold ’Em’s absolute worst possible hand, the 2–7—while literally telling his opponent, Sammy George, that he was holding it. “You don’t have deuce-seven,” George replied. “You don’t have deuce-seven.” George folded, and Dwan—with, yes, deuce-seven—took the pot.
在扑克游戏中,递归是一种危险的游戏。你当然不想落后对手一步——但也切勿领先对手太多。“有一条规则是,你实际上只想比对手高一级,”扑克职业选手瓦内萨·鲁索 (Vanessa Rousso) 解释道。“如果你比对手高出太多,你会认为他们掌握了实际上没有的信息——[并且]他们将无法从你的行动中收集到你希望他们收集的信息。”有时,扑克职业选手会故意引诱对手陷入复杂的递归,而自己则完全照章办事,不顾心理承受能力地玩扑克。这被称为引诱他们“与自己进行升级战”。
In poker, recursion is a dangerous game. You don’t want to get caught one step behind your opponent, of course—but there’s also an imperative not to get too far ahead of them either. “There’s a rule that you really only want to play one level above your opponent,” explains poker professional Vanessa Rousso. “If you play too far above your opponent, you’re going to think they have information that they don’t actually have—[and] they won’t be able to glean the information that you want them to glean from your actions.” Sometimes poker pros will deliberately bait their opponent into a convoluted recursion, meanwhile playing completely by-the-book, unpsychological poker themselves. This is known as luring them into “a leveling war against themselves.”
(在其他游戏中,引诱对手进行无谓的递归也是有效的策略。2008 年,美国象棋大师中村光 (Hikaru Nakamura) 和顶尖计算机象棋程序 Rybka 之间的闪电战对决,是人机象棋历史上最精彩、最奇特、最引人入胜的场面之一。在这场每方都只有三分钟时间走完所有棋步,否则将自动失败的比赛中,计算机显然占据了优势——它每秒可以评估数百万种位置,并且可以毫不费力地走棋。但中村光立刻就让棋盘陷入僵局,然后以最快的速度重复进行毫无意义的走棋。与此同时,计算机浪费了宝贵的时间,徒劳地寻找根本不存在的制胜变式,并执着地试图预测中村未来所有可能的走法,而中村自己只不过是在象棋中无所事事。当计算机几乎耗尽时间时并开始拼命争取不输钱,最终中村建业打开了局面并突破了。)
(Luring an opponent into fruitless recursion can be an effective strategy in other games, too. One of the most colorful, bizarre, and fascinating episodes in the history of man-vs.-machine chess came in a 2008 blitz showdown between American grandmaster Hikaru Nakamura and leading computer chess program Rybka. In a game where each side got just three minutes on the clock to play all of their moves or automatically lose, the advantage surely seemed to be on the side of the computer—capable of evaluating millions of positions every second, and of making its move without twitching a muscle. But Nakamura immediately gridlocked the board, and proceeded to make repetitive, meaningless moves as fast as he could click. Meanwhile, the computer wasted precious moments fruitlessly searching for winning variations that didn’t exist and doggedly trying to anticipate all the possible future moves by Nakamura, who himself was simply doing the chess equivalent of twiddling his thumbs. When the computer had nearly exhausted its time and began flailing so as not to lose by the clock, Nakamura finally opened the position and crashed through.)
鉴于递归的危险性,扑克专业人士如何突破它?他们运用博弈论。“有时你能想出理由来做出剥削性的(升级)打法,但很多时候,你只是因为一些无关紧要的理由而做出劣势打法,”丹·史密斯解释道。“在大多数情况下,我都非常努力地对理论有基本的了解……我总是从了解或尝试了解纳什是什么开始。”
Given recursion’s dangers, how do poker professionals break out of it? They use game theory. “Sometimes you can come up with reasons to make exploitive [leveling] plays, but a lot of the time you are just making inferior plays for reasons that are really just noise,” Dan Smith explains. “I try really hard to have a base level of theory understanding in most situations.… I always start by knowing or trying to know what Nash is.”
那么纳什是什么?
So what is Nash?
达到平衡
Reaching Equilibrium
你知道规则,我也知道。...
You know the rules, and so do I.…
我们了解这个游戏并且我们会玩这个游戏。
We know the game and we’re gonna play it.
—里克·阿斯特利
—RICK ASTLEY
博弈论涵盖了极其广泛的合作与竞争场景,但该领域始于类似单挑扑克的场景:两人竞赛,其中一方的收益就是另一方的损失。分析这些博弈的数学家试图找到所谓的均衡:即一组双方都能遵循的策略,使得任何一方在对手采取某种策略的情况下都不愿改变自己的策略。它之所以被称为均衡,是因为它具有稳定性——任何一方无论进行多少思考都不会做出不同的选择。考虑到你的策略,我对我的策略感到满意;考虑到我的策略,你也对你自己的策略感到满意。
Game theory covers an incredibly broad spectrum of scenarios of cooperation and competition, but the field began with those resembling heads-up poker: two-person contests where one player’s gain is another player’s loss. Mathematicians analyzing these games seek to identify a so-called equilibrium: that is, a set of strategies that both players can follow such that neither player would want to change their own play, given the play of their opponent. It’s called an equilibrium because it’s stable—no amount of further reflection by either player will bring them to different choices. I’m content with my strategy, given yours, and you’re content with your strategy, given mine.
例如,在石头剪刀布游戏中,均衡告诉我们,或许并不那么令人兴奋,让我们完全随机地选择一个同名的手势,每个手势大约占三分之一的时间。这种均衡之所以稳定,是因为一旦双方都采用了这种1 ⁄ 3 - 1 ⁄ 3 - 1 ⁄ 3的策略,那么对任何一方来说,最好的选择就是坚持下去。(如果我们尝试出更多的石头,对手很快就会注意到,并开始出更多的布,这会迫使我们出更多的剪刀,依此类推,直到我们双方都再次回到1 ⁄ 3 - 1 ⁄ 3 - 1 ⁄ 3的均衡状态。)
In rock-paper-scissors, for example, the equilibrium tells us, perhaps unexcitingly, to choose one of the eponymous hand gestures completely at random, each roughly a third of the time. What makes this equilibrium stable is that, once both players adopt this 1⁄3 - 1⁄3 - 1⁄3 strategy, there is nothing better for either to do than stick with it. (If we tried playing, say, more rock, our opponent would quickly notice and start playing more paper, which would make us play more scissors, and so forth until we both settled into the 1⁄3 - 1⁄3 - 1⁄3 equilibrium again.)
数学家约翰·纳什于1951年证明了博弈论中一个开创性的结果:每个双人博弈至少存在一个均衡点。这一重大发现使纳什于1994年荣获诺贝尔经济学奖(并催生了讲述纳什生平的书籍和电影《美丽心灵》)。如今,这种均衡点通常被称为“纳什均衡”——丹·史密斯一直试图追踪的“纳什”。
In one of the seminal results in game theory, the mathematician John Nash proved in 1951 that every two-player game has at least one equilibrium. This major discovery would earn Nash the Nobel Prize in Economics in 1994 (and lead to the book and film A Beautiful Mind, about Nash’s life). Such an equilibrium is now often spoken of as the “Nash equilibrium”—the “Nash” that Dan Smith always tries to keep track of.
表面上看,纳什均衡在双人游戏中始终存在,这似乎让我们从扑克和许多其他常见比赛中那种镜厅递归式的循环中解脱出来。当我们感觉自己掉进递归的兔子洞时,我们总是可以选择跳出对手的思维,直接找到均衡点,假设对手是理性的,就能找到最佳策略。在石头剪刀布游戏中,如果你知道从长远来看,随机出牌是一种无敌的策略,那么仔细观察对手的表情来判断他们接下来会出什么牌可能就没什么意义了。
On the face of it, the fact that a Nash equilibrium always exists in two-player games would seem to bring us some relief from the hall-of-mirrors recursions that characterize poker and many other familiar contests. When we feel ourselves falling down the recursive rabbit hole, we always have an option to step out of our opponent’s head and look for the equilibrium, going directly to the best strategy, assuming rational play. In rock-paper-scissors, scrutinizing your opponent’s face for signs of what they might throw next may not be worthwhile, if you know that simply throwing at random is an unbeatable strategy in the long run.
更广泛地说,纳什均衡可以预测任何一套规则或激励措施的长期稳定结果。因此,它为预测和塑造经济政策以及总体社会政策提供了一个宝贵的工具。正如诺贝尔经济学奖得主罗杰·迈尔森所说,纳什均衡“对经济学和社会科学产生了根本性和普遍性的影响,其影响堪比DNA双螺旋结构在生物科学领域的发现”。
More generally, the Nash equilibrium offers a prediction of the stable long-term outcome of any set of rules or incentives. As such, it provides an invaluable tool for both predicting and shaping economic policy, as well as social policy in general. As Nobel laureate economist Roger Myerson puts it, the Nash equilibrium “has had a fundamental and pervasive impact in economics and the social sciences which is comparable to that of the discovery of the DNA double helix in the biological sciences.”
然而,计算机科学却让这个故事变得复杂。广义上讲,数学研究的对象是真理;计算机科学研究的对象是复杂性。正如我们所见,如果问题难以解决,仅仅有解是不够的。
Computer science, however, has complicated this story. Put broadly, the object of study in mathematics is truth; the object of study in computer science is complexity. As we’ve seen, it’s not enough for a problem to have a solution if that problem is intractable.
在博弈论的语境中,知道均衡的存在并不能真正告诉我们均衡是什么,或者如何达到均衡。正如加州大学伯克利分校计算机科学家克里斯托斯·帕帕迪米特里奥(Christos Papadimitriou)所写,博弈论“通常预测主体的均衡行为,而不考虑如何达到这种状态——而这恰恰是计算机科学家最关心的问题。” 斯坦福大学的蒂姆·拉夫加登(Tim Roughgarden)对纳什关于均衡始终存在的证明感到不满。“好吧,”他说,“但我们是计算机科学家,对吧?给我们一些我们能用的东西。不要只告诉我它在那里;告诉我如何找到它。” 于是,博弈论的原始领域催生了算法博弈论——也就是说,对理论上理想的博弈策略的研究,变成了对机器(和人类)如何制定博弈策略的研究。
In a game-theory context, knowing that an equilibrium exists doesn’t actually tell us what it is—or how to get there. As UC Berkeley computer scientist Christos Papadimitriou writes, game theory “predicts the agents’ equilibrium behavior typically with no regard to the ways in which such a state will be reached—a consideration that would be a computer scientist’s foremost concern.” Stanford’s Tim Roughgarden echoes the sentiment of being unsatisfied with Nash’s proof that equilibria always exist. “Okay,” he says, “but we’re computer scientists, right? Give us something we can use. Don’t just tell me that it’s there; tell me how to find it.” And so, the original field of game theory begat algorithmic game theory—that is, the study of theoretically ideal strategies for games became the study of how machines (and people) come up with strategies for games.
事实证明,过多地询问纳什均衡的问题很快就会让你陷入计算困境。到20世纪末,确定一个博弈是否存在多个均衡,或者一个均衡是否能给玩家带来一定的收益,或者一个均衡是否涉及采取特定行动,都被证明是难以解决的问题。然而,从2005年到2008年,帕帕迪米特里奥和他的同事证明了,仅仅寻找纳什均衡本身也是难以解决的。
As it turns out, asking too many questions about Nash equilibria gets you into computational trouble in a hurry. By the end of the twentieth century, determining whether a game has more than one equilibrium, or an equilibrium that gives a player a certain payoff, or an equilibrium that involves taking a particular action, had all been proved to be intractable problems. Then, from 2005 to 2008, Papadimitriou and his colleagues proved that simply finding Nash equilibria is intractable as well.
像石头剪刀布这样的简单游戏或许一眼就能看出均衡点,但在现实世界复杂的游戏中,我们现在显然不能想当然地认为参与者能够发现或达到游戏的均衡点。这反过来意味着游戏设计者不一定能利用均衡点来预测玩家的行为。这一令人警醒的结果影响深远:纳什均衡在经济理论中一直占据着神圣的地位,作为一种建模和预测市场行为的方法,但这一地位或许并非实至名归。正如帕帕迪米特里奥所解释的那样:“如果一个均衡概念不能被有效地计算,那么它作为理性主体行为预测方法的大部分可信度就会丧失。”麻省理工学院的斯科特·阿伦森对此表示赞同。 “在我看来,”他说,“如果纳什均衡存在这个定理被认为与(比如)自由市场与政府干预的争论相关,那么找到这些均衡[难以解决]这个定理也应该被认为相关。” 纳什均衡的预测能力只有在参与者能够真正找到这些均衡时才有意义。引用eBay前研究主管卡迈勒·贾恩的话:“如果你的笔记本电脑找不到它,市场也找不到。”
Simple games like rock-paper-scissors may have equilibria visible at a glance, but in games of real-world complexity it’s now clear we cannot take for granted that the participants will be able to discover or reach the game’s equilibrium. This, in turn, means that the game’s designers can’t necessarily use the equilibrium to predict how the players will behave. The ramifications of this sobering result are profound: Nash equilibria have held a hallowed place within economic theory as a way to model and predict market behavior, but that place might not be deserved. As Papadimitriou explains, “If an equilibrium concept is not efficiently computable, much of its credibility as a prediction of the behavior of rational agents is lost.” MIT’s Scott Aaronson agrees. “In my opinion,” he says, “if the theorem that Nash equilibria exist is considered relevant to debates about (say) free markets versus government intervention, then the theorem that finding those equilibria is [intractable] should be considered relevant also.” The predictive abilities of Nash equilibria only matter if those equilibria can actually be found by the players. To quote eBay’s former director of research, Kamal Jain, “If your laptop cannot find it, neither can the market.”
主导策略,无论好坏
Dominant Strategies, for Better or Worse
即使我们能够达到均衡,稳定也并不意味着它就是好的。这看似矛盾,但均衡策略——即双方都不愿改变策略——并不一定能带来对双方都最佳的结果。博弈论中最著名、最具挑衅性、也最具争议的双人博弈——“囚徒困境”——最能体现这一点。
Even when we can reach an equilibrium, just because it’s stable doesn’t make it good. It may seem paradoxical, but the equilibrium strategy—where neither player is willing to change tack—is by no means necessarily the strategy that leads to the best outcomes for the players. Nowhere is that better illustrated than in game theory’s most famous, provocative, and controversial two-player game: “the prisoner’s dilemma.”
囚徒困境的运作方式如下。假设你和一名同谋在抢劫银行后被捕,并被关押在不同的牢房。现在,你们必须决定是“合作”——保持沉默,不承认任何罪行——还是“叛逃”——向警方告发对方。你知道,如果你们双方合作并保持沉默,政府将没有足够的证据定罪你们中的任何一方,所以你们都会逍遥法外,平分赃物——假设每人五十万美元。如果你们中的一人叛逃并告发另一人,而另一人保持沉默,那么告发者将获得自由并获得全部一百万美元,而保持沉默的一方将被定罪为唯一实施者,被判处十年徒刑。如果你们双方互相告发,那么你们将共同承担责任并分担刑期:每人五年。
The prisoner’s dilemma works as follows. Imagine that you and a co-conspirator have been arrested after robbing a bank, and are being held in separate jail cells. Now you must decide whether to “cooperate” with each other—by remaining silent and admitting nothing—or to “defect” from your partnership by ratting out the other to the police. You know that if you both cooperate with each other and keep silent, the state doesn’t have enough evidence to convict either one of you, so you’ll both walk free, splitting the loot—half a million dollars each, let’s say. If one of you defects and informs on the other, and the other says nothing, the informer goes free and gets the entire million dollars, while the silent one is convicted as the sole perpetrator of the crime and receives a ten-year sentence. If you both inform on each other, then you’ll share the blame and split the sentence: five years each.
问题就在这里。无论你的同伙做什么,背叛对你来说总是更好的。
Here’s the problem. No matter what your accomplice does, it’s always better for you to defect.
如果你的同伙出卖了你,反过来出卖他们就能让你重获五年的刑期——你会被判共同刑期(五年),而不是独自服满十年。如果你的同伙保持沉默,出卖他们就能让你获得全部一百万美元——你不用分担。无论如何,无论你的同伙做出什么决定,背叛总是比合作更好。不合作总是会让你的处境更糟,无论结果如何。
If your accomplice has ratted you out, ratting them out in turn will give you five years of your life back—you’ll get the shared sentence (five years) rather than serving the whole thing yourself (ten years). And if your accomplice has stayed quiet, turning them in will net you the full million dollars—you won’t have to split it. No matter what, you’re always better off defecting than cooperating, regardless of what your accomplice decides. To do otherwise will always make you worse off, no matter what.
事实上,这使得背叛不仅仅是一种均衡策略,而是一种所谓的占优策略。占优策略完全避免了递归,因为它是对所有对手可能策略的最佳回应——所以你甚至不需要费心去钻研他们的思路。占优策略非常强大。
In fact, this makes defection not merely the equilibrium strategy but what’s known as a dominant strategy. A dominant strategy avoids recursion altogether, by being the best response to all of your opponent’s possible strategies—so you don’t even need to trouble yourself getting inside their head at all. A dominant strategy is a powerful thing.
但现在我们遇到了一个悖论。如果每个人都理性行事,遵循主导策略,那么故事的结局就是你们俩都要服五年苦役——相比于获得自由和每人五十万美元的赔偿,这对所有相关人员来说都无疑是雪上加霜。这怎么可能发生呢?
But now we’ve arrived at the paradox. If everyone does the rational thing and follows the dominant strategy, the story ends with both of you serving five years of hard time—which, compared to freedom and a cool half million apiece, is dramatically worse for everyone involved. How could that have happened?
这已成为传统博弈论的主要见解之一:一组参与者都理性地为自己的利益行事,但对于这些参与者来说,均衡结果可能并不是最好的。
This has emerged as one of the major insights of traditional game theory: the equilibrium for a set of players, all acting rationally in their own interest, may not be the outcome that is actually best for those players.
算法博弈论遵循计算机科学的原理,吸收了这一洞见并将其量化,创造了一种名为“无政府状态的代价”的衡量标准。无政府状态的代价衡量的是合作(由中心设计或协调的解决方案)与竞争(每个参与者都各自努力最大化自身结果)之间的差距。在像囚徒困境这样的博弈中,这个代价实际上是无限的:即使主导策略保持不变,增加赌注金额和延长刑期也能使可能结果之间的差距变得无限大。如果玩家不进行协调,他们所承受的痛苦将是无限的。但在其他博弈中,正如算法博弈论者所发现的那样,无政府状态的代价远没有那么糟糕。
Algorithmic game theory, in keeping with the principles of computer science, has taken this insight and quantified it, creating a measure called “the price of anarchy.” The price of anarchy measures the gap between cooperation (a centrally designed or coordinated solution) and competition (where each participant is independently trying to maximize the outcome for themselves). In a game like the prisoner’s dilemma, this price is effectively infinite: increasing the amount of cash at stake and lengthening the jail sentences can make the gap between possible outcomes arbitrarily wide, even as the dominant strategy stays the same. There’s no limit to how painful things can get for the players if they don’t coordinate. But in other games, as algorithmic game theorists would discover, the price of anarchy is not nearly so bad.
以交通为例。无论是每天试图在拥堵的道路上穿梭的通勤者,还是在互联网上传输TCP数据包的路由器,系统中的每个人都只想选择对自己最方便的方式。司机只想选择最快的路线,无论它是什么;路由器只想以最小的努力传输数据包——但在这两种情况下,这都可能导致关键路径过度拥挤,造成损害所有人的拥堵。但损害有多大呢?令人惊讶的是,Tim Roughgarden和康奈尔大学的Éva Tardos在2002年证明,“自私路由”方法的无政府主义代价仅为4/3。也就是说,混战仅比完美的自上而下的协调低33%。
For instance, consider traffic. Whether it’s individual commuters trying to make their way through the daily bumper-to-bumper, or routers shuffling TCP packets across the Internet, everyone in the system merely wants what’s easiest for them personally. Drivers just want to take the fastest route, whatever it is, and routers just want to shuffle along their packets with minimal effort—but in both cases this can result in overcrowding along critical pathways, creating congestion that harms everyone. How much harm, though? Surprisingly, Tim Roughgarden and Cornell’s Éva Tardos proved in 2002 that the “selfish routing” approach has a price of anarchy that’s a mere 4/3. That is, a free-for-all is only 33% worse than perfect top-down coordination.
Roughgarden 和 Tardos 的研究对城市物理交通规划和网络基础设施都具有深远的影响。例如,自私路由的低无政府主义代价或许可以解释为什么互联网在没有任何中央机构管理单个数据包路由的情况下也能运行良好。即使这种协调是可能的,也不会带来太大的改善。
Roughgarden and Tardos’s work has deep implications both for urban planning of physical traffic and for network infrastructure. Selfish routing’s low price of anarchy may explain, for instance, why the Internet works as well as it does without any central authority managing the routing of individual packets. Even if such coordination were possible, it wouldn’t add very much.
就人类的交通而言,无政府状态的低代价是一把双刃剑。好消息是,缺乏集中协调最多只会让您的通勤状况恶化33%。另一方面,如果您希望联网的自动驾驶汽车能为我们带来交通乌托邦的未来,那么得知如今自私、缺乏协调的驾驶员已经非常接近最佳状态,您可能会感到沮丧。诚然,自动驾驶汽车应该会减少道路交通事故的数量,并且或许能够实现更紧密的车辆间距,这两者都会加速交通。但从拥堵的角度来看,无政府状态的拥堵程度仅为完美协调状态的4/3,这意味着完美协调的通勤拥堵程度也只有现在的3/4。这有点像詹姆斯·布兰奇·卡贝尔的名言:“乐观主义者宣称我们生活在所有可能世界中最好的一个;而悲观主义者则担心这是真的。”交通拥堵永远是一个可以通过规划者和总体需求来解决的问题,而不是通过单个驾驶员(无论是人类还是计算机、自私还是合作)的决定来解决。
When it comes to traffic of the human kind, the low price of anarchy cuts both ways. The good news is that the lack of centralized coordination is making your commute at most only 33% worse. On the other hand, if you’re hoping that networked, self-driving autonomous cars will bring us a future of traffic utopia, it may be disheartening to learn that today’s selfish, uncoordinated drivers are already pretty close to optimal. It’s true that self-driving cars should reduce the number of road accidents and may be able to drive more closely together, both of which would speed up traffic. But from a congestion standpoint, the fact that anarchy is only 4/3 as congested as perfect coordination means that perfectly coordinated commutes will only be 3/4 as congested as they are now. It’s a bit like the famous line by James Branch Cabell: “The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true.” Congestion will always be a problem solvable more by planners and by overall demand than by the decisions of individual drivers, human or computer, selfish or cooperative.
量化无政府状态的代价,为该领域提供了一种具体而严谨的方法来评估去中心化系统的优缺点,这在人们参与博弈(无论他们是否意识到)的众多领域都具有广泛的影响。低的无政府状态代价意味着,无论好坏,系统本身的优劣都与精心管理的系统差不多。另一方面,高昂的无政府状态代价意味着,如果精心协调,事情有可能好转——但如果没有某种形式的干预,我们就会自取灭亡。囚徒困境显然属于后一种类型。不幸的是,世界上许多必须参与的至关重要的博弈也是如此。
Quantifying the price of anarchy has given the field a concrete and rigorous way to assess the pros and cons of decentralized systems, which has broad implications across any number of domains where people find themselves involved in game-playing (whether they know it or not). A low price of anarchy means the system is, for better or worse, about as good on its own as it would be if it were carefully managed. A high price of anarchy, on the other hand, means that things have the potential to turn out fine if they’re carefully coordinated—but that without some form of intervention, we are courting disaster. The prisoner’s dilemma is clearly of this latter type. Unfortunately, so are many of the most critical games the world must play.
公地悲剧
The Tragedy of the Commons
1968年,生态学家加勒特·哈丁以双人囚徒困境为例,设想将其扩大到所有村民的参与。哈丁邀请读者想象一块公共草坪的“公地”——每个人的牲畜都可以在上面吃草,但其容量有限。理论上,所有村民应该只放牧能给每个人留下一些草的牲畜数量。然而,在实践中,放牧量略多一点的好处会直接归于自己,而危害似乎微不足道。然而,如果每个人都遵循这种逻辑,只使用略多于应有量的公共用地,就会产生一种可怕的均衡:草坪被彻底毁坏,从此任何人的牲畜都没有草吃。
In 1968, the ecologist Garrett Hardin took the two-player prisoner’s dilemma and imagined scaling it up to involve all the members of a farming village. Hardin invited his readers to picture a “commons” of public lawn—available to be grazed by everyone’s livestock, but with finite capacity. In theory, all the villagers should graze only as many animals as would leave some grass for everyone. In practice, though, the benefits of grazing a little bit more than that accrue directly to you, while the harms seem too small to be of consequence. Yet if everyone follows this logic of using just slightly more of the commons than they should, a dreadful equilibrium results: a completely devastated lawn, and no grass for anyone’s livestock thereafter.
哈丁将此称为“公地悲剧”,它已成为经济学家、政治学家和环保运动观察污染和气候变化等大规模生态危机的主要视角之一。“我小时候,有一种叫含铅汽油的东西,”卡内基梅隆大学的计算机科学家和博弈论学家阿夫里姆·布鲁姆说。“含铅汽油便宜十美分左右,但它会污染环境……考虑到其他人都在做什么,如果你在自己的车里加含铅汽油,对你个人的健康真的会造成多大的损害?不会严重到哪里去。这就是囚徒困境。”在企业和国家层面也是如此。最近一份报纸的头条简明扼要地指出了这个问题:“稳定的气候要求大多数化石燃料留在地下,但是谁的呢?”每个企业(在某种程度上,每个国家)为了竞争优势,最好比同行更鲁莽一些。然而,如果他们都更加鲁莽地行动,地球就会遭到破坏,而这一切都是徒劳的:相对于他们开始时的情况,任何人都不会获得任何经济优势。
Hardin called this the “tragedy of the commons,” and it has become one of the primary lenses through which economists, political scientists, and the environmental movement view large-scale ecological crises like pollution and climate change. “When I was a kid, there was this thing called leaded gasoline,” says Avrim Blum, Carnegie Mellon computer scientist and game theorist. “Leaded was ten cents cheaper or something, but it pollutes the environment.… Given what everyone else is doing, how much worse really are you personally [health-wise] if you put leaded gasoline in your own car? Not that much worse. It’s the prisoner’s dilemma.” The same is true at the corporate and national levels. A recent newspaper headline put the trouble succinctly: “Stable climate demands most fossil fuels stay in the ground, but whose?” Every corporation (and, to some degree, every nation) is better off being a bit more reckless than their peers for the sake of competitive advantage. Yet if they all act more recklessly, it leads to a ravaged Earth, and all for nothing: there’s no economic advantage for anyone relative to where they started.
这种游戏的逻辑如此普遍,我们甚至不需要关注不法行为就能发现它正在肆虐。我们很容易在问心无愧的情况下最终陷入可怕的平衡。怎么做到的?看看你公司的休假政策就知道了。在美国,人们的工作时间是世界上最长的;正如《经济学人》所说,“没有哪个地方比这里工作价值更高,而休闲价值更低。” 几乎没有法律强制雇主提供休假时间,即使美国员工有假期,他们也不会利用。最近的一项研究表明,普通员工只休了他们获准休假天数的一半,而令人震惊的是,15% 的员工根本不休假。
The logic of this type of game is so pervasive that we don’t even have to look to misdeeds to see it running amok. We can just as easily end up in a terrible equilibrium with a clean conscience. How? Look no further than your company vacation policy. In America, people work some of the longest hours in the world; as the Economist put it, “nowhere is the value of work higher and the value of leisure lower.” There are few laws mandating that employers provide time off, and even when American employees do get vacation time they don’t use it. A recent study showed that the average worker takes only half of the vacation days granted them, and a stunning 15% take no vacation at all.
目前,湾区(我们俩居住的地方)正试图通过彻底改变休假政策来弥补这一糟糕状况——这一转变的出发点是好的,但却注定会以失败告终。其前提听起来很无辜:与其为每位员工规定固定的休假天数,然后浪费人力资源部门的人力来确保没有人超出他们的限额,为什么不直接让员工自由休假呢?为什么不干脆给他们无限的假期呢?迄今为止,坊间传闻褒贬不一——但从博弈论的角度来看,这种方法简直是一场噩梦。理论上,所有员工都希望尽可能多地休假。但他们也都希望休假时间比其他人略少一些,以便被视为更忠诚、更投入、更敬业(从而更有晋升潜力)。每个人都以其他人为基准,并且休假时间略少于这个基准。这场博弈的纳什均衡为零。正如软件公司 Travis CI 的首席执行官 Mathias Meyer 所写:“人们会犹豫是否要休假,因为他们不想看起来像是休假最多的人。这是一场逐底竞争。”
At the present moment, the Bay Area (where the two of us live) is attempting to remedy this sorry state of affairs by going through a radical paradigm shift when it comes to vacation policy—a shift that is very well meaning and completely, apocalyptically doomed. The premise sounds innocent enough: instead of metering out some fixed arbitrary number of days for each employee, then wasting HR man-hours making sure no one goes over their limit, why not just let your employees free? Why not simply allow them unlimited vacation? Anecdotal reports thus far are mixed—but from a game-theoretic perspective, this approach is a nightmare. All employees want, in theory, to take as much vacation as possible. But they also all want to take just slightly less vacation than each other, to be perceived as more loyal, more committed, and more dedicated (hence more promotion-worthy). Everyone looks to the others for a baseline, and will take just slightly less than that. The Nash equilibrium of this game is zero. As the CEO of software company Travis CI, Mathias Meyer, writes, “People will hesitate to take a vacation as they don’t want to seem like that person who’s taking the most vacation days. It’s a race to the bottom.”
这就是公地悲剧的全面爆发。企业之间的情况和企业内部的情况一样糟糕。想象一下,一个小镇上有两个店主。他们每个人都可以选择每周营业七天,或者每周只营业六天,周日休息,与亲朋好友放松一下。如果他们俩都休息一天,就能保住现有的市场份额,减少压力。然而,如果一个店主决定每周营业七天,他就会吸引更多的顾客——从竞争对手那里抢走顾客,并威胁到他的生计。纳什均衡再次表明,每个人都必须一直工作。
This is the tragedy of the commons in full effect. And it’s just as bad between firms as within them. Imagine two shopkeepers in a small town. Each of them can choose either to stay open seven days a week or to be open only six days a week, taking Sunday off to relax with their friends and family. If both of them take a day off, they’ll retain their existing market share and experience less stress. However, if one shopkeeper decides to open his shop seven days a week, he’ll draw extra customers—taking them away from his competitor and threatening his livelihood. The Nash equilibrium, again, is for everyone to work all the time.
这个问题在2014年美国假日季成为焦点,零售商们不愿将市场份额拱手让给那些抢占感恩节后购物高峰的竞争对手,纷纷向糟糕的均衡状态屈服。《国际财经时报》报道称:“商店开门比以往任何时候都早。”梅西百货决定比去年提前两个小时开门,塔吉特也是如此。凯马特则在感恩节早上6点开门,并连续营业了42个小时。
This exact issue became a flash point in the United States during the 2014 holiday season, as retailer after retailer, unwilling to cede market share to competitors who were getting ahead of the usual post-Thanksgiving shopping rush, caved in toward the lousy equilibrium. “Stores are opening earlier than ever before,” the International Business Times reported. Macy’s decided to open two hours earlier than the year before, as did Target. Kmart, for its part, opened at 6:00 a.m. on Thanksgiving morning, and was continuously open for forty-two hours.
那么,当我们身处这样的境地时——无论是两方囚徒困境,还是多方公地悲剧——我们作为参与者能做什么呢?从某种意义上说,什么也做不了。这些糟糕均衡所拥有的稳定性,以及使它们成为均衡的因素,变得令人发指。总的来说,我们无法从内部改变主导策略。但这并不意味着糟糕的均衡无法修复。这仅仅意味着解决方案必须从其他地方寻找。
So what can we, as players, do when we find ourselves in such a situation—either the two-party prisoner’s dilemma, or the multi-party tragedy of the commons? In a sense, nothing. The very stability that these bad equilibria have, the thing that makes them equilibria, becomes damnable. By and large we cannot shift the dominant strategies from within. But this doesn’t mean that bad equilibria can’t be fixed. It just means that the solution is going to have to come from somewhere else.
机制设计:改变游戏规则
Mechanism Design: Change the Game
不要恨玩家,要恨游戏。
Don’t hate the player, hate the game.
—ICE-T
—ICE-T
永远不要再站在任何反对家庭的人一边——永远。
Don’t ever take sides with anyone against the family again—ever.
— 《教父》
—THE GODFATHER
囚徒困境一直是几代人关于人类合作本质的争论焦点,但伦敦大学学院博弈论学家肯·宾莫尔认为,至少部分争论是误导性的。正如他所言,“囚徒困境完全错误地抓住了人类合作的关键所在。恰恰相反,它代表了一种骰子尽可能不利于合作出现的局面。” *
The prisoner’s dilemma has been the focal point for generations of debate and controversy about the nature of human cooperation, but University College London game theorist Ken Binmore sees at least some of that controversy as misguided. As he argues, it’s “just plain wrong that the Prisoner’s Dilemma captures what matters about human cooperation. On the contrary, it represents a situation in which the dice are as loaded against the emergence of cooperation as they could possibly be.”*
好吧,如果游戏规则迫使我们采取错误的策略,也许我们不应该试图改变策略。也许我们应该尝试改变游戏本身。
Well, if the rules of the game force a bad strategy, maybe we shouldn’t try to change strategies. Maybe we should try to change the game.
这引出了博弈论的一个分支,即“机制设计”。博弈论探讨的是给定一套规则会出现什么样的行为,而机制设计(有时也称为“逆博弈论”)则反其道而行之,探讨的是:什么样的规则会引导我们产生我们想要看到的行为?如果说博弈论的启示——例如均衡策略可能对每个参与者来说都是理性的,但对每个人来说都是有害的——已被证明是违反直觉的,那么机制设计的启示则更是如此。
This brings us to a branch of game theory known as “mechanism design.” While game theory asks what behavior will emerge given a set of rules, mechanism design (sometimes called “reverse game theory”) works in the other direction, asking: what rules will give us the behavior we want to see? And if game theory’s revelations—like the fact that an equilibrium strategy might be rational for each player yet bad for everyone—have proven counterintuitive, the revelations of mechanism design are even more so.
让我们把你和你的银行抢劫同伙送回牢房,再次体验囚徒困境,并增加一个关键因素:教父。现在你和你的同伙是一个犯罪集团的成员,而教父已经明确表示,任何告密者都会与恶人同床共枕。这种对博弈收益的改变限制了你们可以采取的行动,但讽刺的是,这反而大大增加了事情顺利结束的可能性,对你和你的同伙来说都是如此。由于背叛现在不那么有吸引力了(委婉地说),两名囚犯都被诱导合作,并且两人都自信地带着五十万美元的财富离开。当然,除了给教父象征性地缴纳的什一税之外。
Let’s return you and your bank-robbing co-conspirator to the jail cell for another go at the prisoner’s dilemma, with one crucial addition: the Godfather. Now you and your fellow thief are members of a crime syndicate, and the don has made it, shall we say, all too clear that any informants will sleep with the fishes. This alteration of the game’s payoffs has the effect of limiting the actions you can take, yet ironically makes it far more likely that things will end well, both for you and your partner. Since defection is now less attractive (to put it mildly), both prisoners are induced to cooperate, and both will confidently walk away half a million dollars richer. Minus, of course, a nominal tithe to the don.
这里违反直觉而又强大的事情是,我们可以使每一种结果都变得更糟——一方面是死亡,另一方面是税收——但通过改变平衡,让每个人的生活变得更好。
The counterintuitive and powerful thing here is we can worsen every outcome—death on the one hand, taxes on the other—yet make everyone’s lives better by shifting the equilibrium.
对于小镇店主来说,口头休周日假的协议很不稳固:一旦任何一方需要额外收入,就有可能违反协议,迫使另一方也开始在周日工作,以免丢失市场份额。这会让他们再次陷入糟糕的均衡状态,两头受苦——精疲力竭,却得不到任何竞争优势。但他们或许可以充当自己的老板,签署一份具有法律约束力的合同,规定任何一方在周日赚取的任何收益都归另一方所有。通过恶化这种不令人满意的均衡,他们可以创造一个新的、更好的均衡。
For the small-town shopkeepers, a verbal truce to take Sundays off would be unstable: as soon as either shopkeeper needed some extra cash he’d be liable to violate it, prompting the other to start working Sundays as well so as not to lose market share. This would land them right back in the bad equilibrium where they get the worst of both worlds—they’re exhausted and don’t get any competitive advantage for it. But they might be able to act as their own don by signing a legally binding contract to the effect that, say, any proceeds earned by either shop on a Sunday go to the other shop. By worsening the unsatisfactory equilibrium, they’d make a new and better one.
另一方面,如果博弈结果的改变不改变均衡,其效果通常会远低于预期。软件公司 Evernote 的首席执行官 Phil Libin 曾因一项政策而登上头条,该政策规定为 Evernote 员工提供一千美元现金作为休假奖励。这听起来像是一个让更多员工休假的合理方法,但从博弈论的角度来看,这实际上是误导。例如,在囚徒困境中增加现金就错失了要点:这种改变并不能改变糟糕的均衡。如果一百万美元的抢劫最终导致两名窃贼都锒铛入狱,那么一千万美元的抢劫也是如此。问题不在于假期缺乏吸引力;问题在于每个人都想比其他人少休假一点,从而导致博弈的结果就是完全没有假期。一千美元虽然让交易更具吸引力,但却不会改变游戏规则——即尽可能多地休假,同时仍然被认为比下一个人更忠诚,从而获得价值数千美元的加薪或晋升。
On the other hand, a change to the game’s payoffs that doesn’t change the equilibrium will typically have a much smaller effect than desired. The CEO of the software firm Evernote, Phil Libin, made headlines with a policy of offering Evernote employees a thousand dollars cash for taking a vacation. This sounds like a reasonable approach to getting more employees to take vacation, but from a game-theoretic perspective it’s actually misguided. Increasing the cash on the table in the prisoner’s dilemma, for instance, misses the point: the change doesn’t do anything to alter the bad equilibrium. If a million-dollar heist ends up with both thieves in jail, so does a ten-million-dollar heist. The problem isn’t that vacations aren’t attractive; the problem is that everyone wants to take slightly less vacation than their peers, producing a game whose only equilibrium is no vacation at all. A thousand bucks sweetens the deal but doesn’t change the principle of the game—which is to take as much vacation as possible while still being perceived as slightly more loyal than the next guy or gal, therefore getting a raise or promotion over them that’s worth many thousands of dollars.
这是否意味着利宾需要为每位员工每次休假提供数万美元?并非如此。机制设计告诉我们,利宾可以用大棒而不是胡萝卜来获得他想要的快乐员工;他可以不花一分钱就获得更好的均衡。例如,他可以简单地强制规定一定数量的最低休假时间。如果他无法改变竞争格局,他仍然可以改变垫底的局面。机制设计强有力地证明了设计师的必要性——无论是首席执行官、约束所有各方的合同,还是用绞刑架勒住颈动脉强制执行缄默法的教父。
Does this mean that Libin needs to offer tens of thousands of dollars per employee per vacation? No. Mechanism design tells us that Libin can get the happy employees he wants with the stick, rather than the carrot; he can get a better equilibrium without spending a dime. For instance, he could simply make a certain minimal amount of vacation compulsory. If he can’t change the race, he can still change the bottom. Mechanism design makes a powerful argument for the need for a designer—be it a CEO, a contract binding all parties, or a don who enforces omertà by garroted carotid.
联盟总裁也是这样的设计师。想象一下,如果没有这样的比赛,NBA 会是什么样子,球队可以在赛季开始和结束之间的任何时间互相得分:周日凌晨 3 点,圣诞节中午,随便什么时间。你会看到憔悴不堪、面色苍白的球员,严重缺乏睡眠,被迫服用化学兴奋剂保持警惕,几乎失去理智。战争就是这样。另一方面,即使是华尔街,这个在“不夜城”以微秒为单位进行交易的冷酷资本家,每天下午 4 点也会准时停火,这样经纪人就可以每晚在可预测的时间睡觉,而不会被竞争对手伏击,他们正努力实现不眠平衡。从这个意义上说,股市更像是一项运动,而不是一场战争。
A league commissioner is this kind of a designer as well. Imagine how pathetic a sight the NBA would be if there were no games as such, and teams could simply score on each other at literally any time between the start and end of the season: 3:00 a.m. on a Sunday, noon on Christmas, you name it. What you’d see would be haggard, cadaverous players, in extreme sleep debt, forcing vigilance with chemical stimulants, almost losing their minds. War is like this. On the other hand, even Wall Street, ruthless cutthroat capitalists trading by the microsecond in the “city that never sleeps,” comes to a cease-fire every day at 4:00 p.m. sharp, so that brokers can sleep at predictable hours every night without getting too badly ambushed by competitors pushing toward a sleepless equilibrium. In this sense, the stock market is more a sport than a war.
将此逻辑放大,便能为政府的作用提供强有力的论据。事实上,许多政府确实有法律规定最低休假时间和限制商店营业时间。虽然美国是少数几个没有联邦带薪休假要求的发达国家之一,但马萨诸塞州、缅因州和罗德岛州确实在州一级禁止感恩节商业活动。
Scaling up this logic results in a potent argument for the role of government. In fact, many governments do have laws on the books mandating minimum vacations and limiting shop hours. And while the United States is one of the only developed nations without federal requirements for paid vacation, Massachusetts, Maine, and Rhode Island do have state-level prohibitions on Thanksgiving commerce.
这类法律通常源于殖民时代,最初本质上是宗教性的。事实上,宗教本身提供了一种非常直接的方式来改变这类博弈的结构。尤其是像“记念安息日”这样的宗教律法,无论它是由全能的上帝还是由宗教社群中更亲近的成员强制执行,都能巧妙地解决店主面临的问题。此外,在针对其他反社会行为(例如谋杀、通奸和盗窃)的禁令中附加神力,同样可以解决社会群体生活中的一些博弈论问题。在这方面,上帝甚至比政府更胜一筹,因为全知全能提供了强有力的保证,即做坏事将导致可怕的后果。事实证明,没有哪个教父能像天父一样。
Laws like these often stem from the colonial era and were initially religious in nature. Indeed, religion itself provides a very direct way of modifying the structure of games of this kind. In particular, a religious law such as “Remember the Sabbath day” neatly solves the problem faced by the shopkeepers, whether enforced by an all-powerful God or by the more proximate members of a religious community. And adding divine force to injunctions against other kinds of antisocial behavior, such as murder, adultery, and theft, is likewise a way to solve some of the game-theoretic problems of living in a social group. God happens to be even better than government in this respect, since omniscience and omnipotence provide a particularly strong guarantee that taking bad actions will have dire consequences. It turns out there’s no Godfather quite like God the Father.
宗教似乎是计算机科学家很少谈论的话题;事实上,它确实是一本名为《计算机科学家很少谈论的事情》的书的主题。但是,通过减少人们的选择数量,宗教所施加的行为约束不仅降低了某些决策的计算难度,还能产生更好的结果。
Religion seems like the kind of thing a computer scientist rarely talks about; in fact, it’s literally the subject of a book called Things a Computer Scientist Rarely Talks About. But by reducing the number of options that people have, behavioral constraints of the kind imposed by religion don’t just make certain kinds of decisions less computationally challenging—they can also yield better outcomes.
进化机制设计
Mechanism Design by Evolution
不管人们认为一个人有多么自私,他的本性中显然存在着一些原则,这些原则使他对他人的命运感兴趣,并把他人的幸福视为自己的必需品,尽管他除了看到幸福而感到快乐之外,并没有从中获得任何东西。
How selfish soever man may be supposed, there are evidently some principles in his nature, which interest him in the fortune of others, and render their happiness necessary to him, though he derives nothing from it, except the pleasure of seeing it.
—亚当·斯密, 《道德情操论》
—ADAM SMITH, THE THEORY OF MORAL SENTIMENTS
心有其理,而理智却不知道。
The heart has its reasons which reason knows nothing of.
—布莱斯·帕斯卡
—BLAISE PASCAL
加州红杉是地球上最古老、最雄伟的生物之一。然而,从博弈论的角度来看,它们却堪称一场悲剧。它们之所以如此高大,唯一的原因是它们试图比彼此更高——以至于过度扩张的危害最终甚至比被遮蔽的危害还要严重。正如理查德·道金斯所说,
The redwoods of California are some of the oldest and most majestic living things on the planet. From a game-theoretic standpoint, though, they’re something of a tragedy. The only reason they’re so tall is that they’re trying to be taller than each other—up to the point where the harms of overextension are finally even worse than the harms of getting shaded out. As Richard Dawkins puts it,
冠层可以被认为是一片空中草甸,就像一片起伏的草原,只不过是用支柱支撑起来的。冠层收集太阳能的速度与草原大致相同。但相当一部分能量被“浪费”了,直接被输送到支柱上。支柱除了把“草甸”高高地托起外,没有任何实际用途。在那里,它吸收的光子数量与平放在地面上时完全相同,但成本要低得多。
The canopy can be thought of as an aerial meadow, just like a rolling grassland prairie, but raised on stilts. The canopy is gathering solar energy at much the same rate as a grassland prairie would. But a substantial portion of the energy is “wasted” by being fed straight into the stilts, which do nothing more useful than loft the “meadow” high in the air, where it picks up exactly the same harvest of photons as it would—at far lower cost—if it were laid flat on the ground.
如果森林能以某种方式达成某种休战协议,生态系统就能享受光合作用的丰厚回报,而不必在木材生产“军备竞赛”中浪费掉所有资源。但正如我们所见,这些情景中的好结果往往只有在博弈之外的权威——有人自上而下地改变收益——的背景下才会出现。如此看来,在自然界中,个体之间似乎根本无法建立良好的均衡。
If the forest could only somehow agree to a kind of truce, the ecosystem could enjoy the photosynthetic bounty without the wood-making arms race wasting it all. But as we’ve seen, good outcomes in these scenarios tend only to arise in the context of an authority outside the game—someone changing the payoffs from the top down. It would seem as though in nature, then, there is simply no way of establishing good equilibria between individuals.
另一方面,如果合作确实在某些博弈中带来更好的结果,那么我们预期具有合作思维的物种将在进化中占上风。但如果合作只在群体层面而非个体层面具有理性,那么合作从何而来?或许它必须来自个体无法完全控制的某种因素。例如,情绪。
On the other hand, if cooperation really does lead to better outcomes in certain games, then we’d expect that cooperatively minded species would prevail evolutionarily. But then where would the cooperation come from if it’s only rational at the group level, not the individual level? Maybe it would have to come from something that individuals can’t entirely control. Something, for instance, like emotions.
考虑两个看似毫不相关的场景:(1)一名男子买了一台吸尘器,几周后就坏了,他花了十分钟在网上留下了一条恶意评论。(2)一名在便利店购物的女子发现有人偷了一位老人的钱包,便夺门而出;她搏斗了小偷,夺回了钱包。
Consider two seemingly unrelated scenarios: (1) A man buys a vacuum cleaner, it breaks within a few weeks, and he spends ten minutes online leaving a vindictive review. (2) A woman shopping at a convenience store notices someone steal an elderly man’s wallet and bolt for the door; she tackles the thief and wrestles the wallet free.
虽然后者的主角显然英勇无畏,而前者只是愤怒,但这些小插曲的共同点——尽管方式截然不同——是无意识的无私奉献。这位不满意的消费者并非想换掉吸尘器或退款;他追求的是一种高度间接的报复,从理性的博弈论角度来看,除了写评论本身带来的怨恨满足感之外,他几乎得不到任何回报。在便利店里,这位英勇的女性以巨大的个人代价执行私刑;她冒着受伤甚至死亡的风险,只为了给一个完全陌生的男人退还40美元。即使她想帮忙,她也可以直接从自己的口袋里掏出两张20美元的钞票给他,而不用冒着去急诊室的风险!从这个意义上讲,两位主角的行为都是非理性的。另一方面,他们的行为对社会是有益的:我们都希望生活在一个扒窃不会带来好处、销售劣质产品的企业名声不好的世界。
Though the latter protagonist seems clearly heroic, and the former merely angry, what these vignettes have in common—albeit in very different ways—is involuntary selflessness. The unhappy consumer isn’t trying to get the vacuum cleaner replaced or his money back; he’s after a highly indirect kind of retribution, from which—in a rational, game-theoretic sense—he stands to gain little other than the spiteful satisfaction of writing the review itself. In the convenience store, the heroic woman metes out vigilante justice at enormous personal cost; she risks injury or even death to return, say, $40 to a man who is a total stranger to her. Even if she wanted to help, she could have simply taken two twenties out of her own pocket and given them to him without risking a trip to the ER! In this sense, both protagonists are acting irrationally. On the other hand, their actions are good for their society: we all want to live in a world in which pickpocketing doesn’t pay and in which businesses that sell poor-quality products get a bad reputation.
或许,我们每个人,如果能成为那种始终能够客观、审慎地做出符合自身最佳利益决定的人,会更好,不会愿意浪费时间去为沉没成本而恼火,更不会为了40美元而掉一颗牙。但生活在一个普遍存在这种反抗立场的社会里,我们所有人都会更好。
Perhaps each of us, individually, would be better off being the kind of person who can always make a detached, calculated decision in their own best interest, not willing to lose time fuming over a sunk cost, let alone lose a tooth over $40. But all of us are better off living in a society in which such defiant stands are common.
那么,在缺乏外部权威的情况下,是什么驱使这些人打破了自私的平衡呢?首先是愤怒。无论是被劣质商品还是小偷小摸所激怒,愤怒都能凌驾于理性之上。在这些情况下,或许是进化之手完成了原本需要外部权威才能完成的事情。
So what has acted up in these people, in the absence of an external authority, to make them buck the selfish equilibrium? Anger, for one thing. Whether prompted by a shoddy business or a petty thief, outrage can override rationality. And in these instances, it may be that the hand of evolution has done what it would otherwise have taken an authority outside the game to accomplish.
自然界中充满了个体被劫持以服务于其他物种目标的例子。例如,柳叶肝吸虫(学名: Dicrocoelium dendriticum)是一种寄生虫,它会让蚂蚁故意爬到草叶顶端,以便被羊——柳叶肝吸虫的首选宿主——吃掉。同样,弓形虫(Toxoplasma gondii)会使老鼠永久地失去对猫的恐惧,也会产生类似的效果。
Nature is full of examples of individuals being essentially hijacked to serve the goals of another species. The lancet liver fluke (Dicrocoelium dendriticum), for instance, is a parasite that makes ants deliberately climb to the tops of grass blades so that they’ll be eaten by sheep—the lancet fluke’s preferred host. Likewise, the parasite Toxoplasma gondii makes mice permanently lose their fear of cats, with similar results.
无论是对心怀怨恨、报复心强的消费者,还是对便利店英雄来说,情绪都意味着我们人类暂时掌控了局面。尼采写道:“道德是个体的从众本能。” 稍加解释,我们可以大胆地认为情绪是人类自身的机制设计。正因为情感是无意识的,它们才使得无需外部强制的契约得以实现。复仇几乎从来都不会对寻求复仇的人有利,然而,那些在被利用时会以“非理性”的激烈反应做出反应的人,正因如此,更有可能获得公平的对待。正如康奈尔大学经济学家罗伯特·弗兰克所说:“如果人们期望我们对财产被盗做出非理性的反应,我们很少需要这样做,因为偷窃财产不符合他们的利益。在这种情况下,倾向于做出非理性的反应比仅仅受物质私利的驱使要好得多。”
Emotion, for the bitter, retaliatory consumer and for the convenience-store hero alike, is our own species taking over the controls for a minute. “Morality is herd instinct in the individual,” wrote Nietzsche. Paraphrasing slightly, we might hazard that emotion is mechanism design in the species. Precisely because feelings are involuntary, they enable contracts that need no outside enforcement. Revenge almost never works out in favor of the one who seeks it, and yet someone who will respond with “irrational” vehemence to being taken advantage of is for that very reason more likely to get a fair deal. As Cornell economist Robert Frank puts it, “If people expect us to respond irrationally to the theft of our property, we will seldom need to, because it will not be in their interests to steal it. Being predisposed to respond irrationally serves much better here than being guided only by material self-interest.”
(为了避免你认为现代文明人拥有合法的合同和法治而不是报复,请记住,起诉或起诉某人所付出的努力和遭受的痛苦往往比受害者希望获得的物质补偿要多。诉讼是发达社会自我毁灭式报复的手段,而不是替代品。)
(Lest you think that civilized modern humans have legal contracts and rule of law instead of retribution, recall that it’s often more work and suffering to sue or prosecute someone than the victim could ever hope to recover in material terms. Lawsuits are the means for self-destructive retaliation in a developed society, not the substitute.)
正如愤怒一样,同情和内疚以及爱也是如此。
As for anger, so for compassion and guilt—and love.
囚徒困境听起来可能有点奇怪,但它也能揭示很多关于婚姻的道理。在第一章讨论秘书问题等最优终止问题时,我们曾将约会和找房子视为我们必须做出承诺的案例,而未来可能的选择尚不明朗。然而,无论是爱情还是住房,即使在做出最优终止决策后,我们仍会面临更多选择——所以,为什么不做好跳槽的准备呢?当然,如果知道对方(无论是配偶还是房东)也准备跳槽,就会阻碍许多让这些协议变得有价值的长期投资(例如共同生育孩子,或者费力地搬进自己的物品)。
As odd as it might sound, the prisoner’s dilemma also has a lot to tell us about marriage. In our discussion of optimal stopping problems, such as the secretary problem, back in chapter 1, we looked at both dating and apartment hunting as cases where we must make a commitment with possible future options yet unseen. In both love and housing, though, we continue to encounter more options even after our optimal-stopping decision is made—so why not be ready to jump ship? Of course, knowing that the other party (be it spouse or landlord) is in turn prepared to jump ship would prevent many of the long-term investments (having children together, or laboriously moving in one’s belongings) that make those agreements worthwhile.
在这两种情况下,所谓的承诺问题至少可以通过合同得到部分解决。但博弈论表明,在约会的情况下,法律的自愿约束与持久的伴侣关系的关联性不如爱情本身的非自愿约束。正如罗伯特·弗兰克所说:“如果一开始就不是理性的评估约束着人们,那么人们会因为以后可能变得理性而离开一段感情的担忧就会在很大程度上消失。” 他解释道:
In both cases this so-called commitment problem can be at least partially addressed by a contract. But game theory suggests that in the case of dating, the voluntary bonds of the law are less relevant to an enduring partnership than the involuntary bonds of love itself. As Robert Frank puts it, “The worry that people will leave relationships because it may later become rational for them to do so is largely erased if it is not rational assessment that binds them in the first place.” He explains:
是的,人们会寻找他们关心的客观特质。每个人都想要一个善良、聪明、有趣、健康、或许还有外表吸引力、赚钱能力强的人,所有这些特质都值得拥有,但这只是第一步……在一起足够长的时间后,让你们想继续在一起的并非这些特质。真正重要的是那个人——对你来说才是有价值的,所以你真正需要的不是合同,而是那种让你不想分开的感觉,即使客观上可能有更好的选择。
Yes, people search for objective characteristics they care about. Everybody wants somebody who’s kind and intelligent and interesting and healthy and maybe physically attractive, good earning power, the whole laundry list of features, but that’s the first pass.… After you’ve spent enough time together, it’s not those things that make you want to stay together. It’s just the fact that it’s that particular person—that is what’s valuable to you, so you don’t really need the contract so much as you need a feeling that makes you not want to separate, even though objectively there might be a better option available to you.
换句话说:爱情就像有组织的犯罪。它改变了婚姻博弈的结构,使均衡成为对双方都最有利的结果。
Said differently: Love is like organized crime. It changes the structure of the marriage game so that the equilibrium becomes the outcome that works best for everybody.
剧作家萧伯纳曾这样描写婚姻:“如果囚犯快乐,为什么要把他锁起来?如果他不快乐,为什么要假装快乐?” 博弈论为这个谜题提供了一个巧妙的答案。快乐就是锁。
Playwright George Bernard Shaw once wrote of marriage that “If the prisoner is happy, why lock him in? If he is not, why pretend that he is?” Game theory offers a subtle answer to this particular riddle. Happiness is the lock.
博弈论中关于爱情的论证会进一步凸显这一点:婚姻就像囚徒困境,你可以选择与你同流合污的人。这看似一个小小的改变,却可能对你正在玩的游戏的结构产生巨大的影响。如果你知道,出于某种原因,你的同伙在你不在的时候会很痛苦——那种痛苦即使一百万美元也无法治愈——那么你就不会那么担心他们会叛逃,把你丢在监狱里自生自灭了。
A game-theoretic argument for love would highlight one further point: marriage is a prisoner’s dilemma in which you get to choose the person with whom you’re in cahoots. This might seem like a small change, but it potentially has a big effect on the structure of the game you’re playing. If you knew that, for some reason, your partner in crime would be miserable if you weren’t around—the kind of misery even a million dollars couldn’t cure—then you’d worry much less about them defecting and leaving you to rot in jail.
所以,爱情的理性论据是双重的:依恋的情感不仅能让你免于反复思考伴侣的意图,还能通过改变回报,最终带来更好的结果。更重要的是,能够不由自主地坠入爱河,反过来也会让你成为一个更有吸引力伴侣。你承受心碎的能力,以及与情感鱼儿同眠的能力,正是这种特质让你成为如此值得信赖的伴侣。
So the rational argument for love is twofold: the emotions of attachment not only spare you from recursively overthinking your partner’s intentions, but by changing the payoffs actually enable a better outcome altogether. What’s more, being able to fall involuntarily in love makes you, in turn, a more attractive partner to have. Your capacity for heartbreak, for sleeping with the emotional fishes, is the very quality that makes you such a trusty accomplice.
信息瀑布:泡沫的悲剧理性
Information Cascades: The Tragic Rationality of Bubbles
每当你发现自己站在大多数人的一边时,就该停下来反思了。
Whenever you find yourself on the side of the majority, it is time to pause and reflect.
—马克·吐温
—MARK TWAIN
关注他人行为之所以有益,部分原因在于,这样做能让你了解他们关于世界的信息,并融入到你自己的认知中。一家人气旺的餐厅或许是个好兆头;半空的音乐厅或许是个坏兆头;如果你正在交谈的人突然将目光转向你看不见的地方,转过头去或许也不错。
Part of the reason why it’s a good idea to pay attention to the behavior of others is that in doing so, you get to add their information about the world to your own. A popular restaurant is probably good; a half-empty concert hall is probably a bad sign; and if someone you’re talking to abruptly yanks their gaze toward something you can’t see, it’s probably not a bad idea to turn your head, too.
另一方面,向他人学习并不总是显得特别理性。潮流和时尚源于盲目跟风,而没有基于任何关于世界的基本客观真理。更糟糕的是,假设他人的行为具有指导意义,可能会导致从众心理,最终引发经济灾难。如果其他人都在投资房地产,那么买房似乎是个好主意;毕竟,房价只会涨,不是吗?
On the other hand, learning from others doesn’t always seem particularly rational. Fads and fashions are the result of following others’ behavior without being anchored to any underlying objective truth about the world. What’s worse, the assumption that other people’s actions are a useful guide can lead to the sort of herd-following that precipitates economic disaster. If everybody else is investing in real estate, it seems like a good idea to buy a house; after all, the price is only going to go up. Isn’t it?
2007-2009年次贷危机的一个有趣之处在于,所有相关人员似乎都觉得自己只是做了自己应该做的事情,却受到了不公平的惩罚。一代美国人从小就相信房屋是万无一失的投资,他们看到周围的人人都在房价快速上涨(或正因为房价)的情况下买房,而当房价最终开始暴跌时,他们遭受了巨大的损失。与此同时,银行家们也觉得自己受到了不公平的指责,因为他们一直在做着自己一直在做的事情——提供机会,而客户可以选择接受或拒绝。在市场突然崩盘之后,人们总是忍不住要追究责任。博弈论提供了一个令人警醒的视角:即使没有人犯错,这样的灾难也可能发生。
An interesting aspect of the 2007–2009 mortgage crisis is that everybody involved seemed to feel like they were unfairly punished for simply doing what they were supposed to. A generation of Americans who grew up believing that houses were fail-safe investments, and who saw everyone around them buying houses despite (or because of) rapidly rising prices, were badly burned when those prices finally started to tumble. Bankers, meanwhile, felt they were unfairly blamed for doing what they had always done—offering opportunities, which their clients could accept or decline. In the wake of an abrupt market collapse, the temptation is always to assign blame. Here game theory offers a sobering perspective: catastrophes like this can happen even when no one’s at fault.
正确理解金融泡沫的运作机制,始于理解拍卖。虽然拍卖看似经济的利基市场——例如苏富比和佳士得拍卖行百万美元级别的油画,或eBay上的豆豆娃玩具和其他收藏品——但实际上,拍卖驱动着经济的很大一部分。例如,谷歌90%以上的收入来自广告销售,而这些广告都是通过拍卖出售的。与此同时,政府也通过拍卖出售电信频谱(例如手机传输频率)的使用权,从而获得了数百亿美元的收入。事实上,从房地产到图书再到郁金香,许多全球市场都通过各种形式的拍卖来运作。
Properly appreciating the mechanics of financial bubbles begins with understanding auctions. While auctions may seem like niche corners of the economy—evoking either million-dollar oil paintings at Sotheby’s and Christie’s, or Beanie Babies and other collectibles on eBay—they actually power a substantial portion of the economy. Google, for instance, makes more than 90% of its revenue from selling ads, and those ads are all sold via auctions. Meanwhile, governments use auctions to sell rights to bands of the telecommunications spectrum (such as cell phone transmission frequencies), raising tens of billions of dollars in revenue. In fact, many global markets, in everything from homes to books to tulips, operate via auctions of various styles.
最简单的拍卖形式之一是每个参与者秘密写下他们的出价,出价最高的人将以其写下的价格赢得该物品。这被称为“密封投标最高价格拍卖”,从算法博弈论的角度来看,它存在一个很大的问题——实际上是几个问题。首先,赢家总是出价过高:如果你对一件物品的估价是 25 美元,我给它估价 10 美元,我们都给出了自己的真实估价(25 美元和 10 美元),那么你最终会以 25 美元的价格买下它,而你本来可以以略高于 10 美元的价格买到它。反过来,这个问题又引出了另一个问题,那就是为了正确出价——也就是说,为了不支付过高的价格——你需要预测拍卖中其他玩家的真实估价,并相应地“调整”你的出价。这已经够糟糕的了——但其他玩家也不会给出他们的真实估价,因为他们会根据对你的预测来调整他们的出价!我们又回到了递归的世界。
One of the simplest auction formats has each participant write down their bid in secret, and the one whose bid is highest wins the item for whatever price they wrote down. This is known as a “sealed-bid first-price auction,” and from an algorithmic game theory perspective there’s a big problem with it—actually, several. For one thing, there’s a sense in which the winner always overpays: if you value an item at $25 and I value it at $10, and we both bid our true valuations ($25 and $10), then you end up buying it for $25 when you could have had it for just a hair over $10. This problem, in turn, leads to another one, which is that in order to bid properly—that is, in order not to overpay—you need to predict the true valuation of the other players in the auction and “shade” your bid accordingly. That’s bad enough—but the other players aren’t going to bid their true valuations either, because they’re shading their bids based on their prediction of yours! We are back in the land of recursion.
另一种经典的拍卖形式是“荷兰式拍卖”或“降价拍卖”,它会逐渐降低物品的价格,直到有人愿意购买。该拍卖的名称指的是阿尔斯米尔鲜花拍卖会,这是世界上最大的鲜花拍卖会,每天在荷兰举行——但荷兰式拍卖比乍一看更为普遍。商店降价出售未售出的商品,房东以他们认为市场能够承受的最高价格挂牌出售公寓,两者都具有类似的基本特征:卖家很可能一开始就持乐观态度,然后逐渐压低价格,直到找到买家。降价拍卖与首价拍卖类似,你更有可能通过支付接近你预期上限的价格(例如,当价格降至 25 美元时,你才会准备出价)赢得竞标,因此你会希望通过一些复杂的策略性金额来降低你的出价。你会以 25 美元的价格买入,还是保持观望,等待更低的价格?你省下的每一美元都可能让你损失殆尽。
Another classic auction format, the “Dutch auction” or “descending auction,” gradually lowers an item’s price until someone is willing to buy it. The name references the Aalsmeer Flower Auction, the largest flower auction in the world, which takes place daily in the Netherlands—but Dutch auctions are more prevalent than they might initially seem. A store marking down its unsold items, and landlords listing apartments at the highest price they think the market will bear, both share its basic quality: the seller is likely to begin optimistically and nudge the price down until a buyer is found. The descending auction resembles the first-price auction in that you’re more likely to win by paying near the top of your range (i.e., you’ll be poised to bid as the price falls to $25), and therefore will want to shade your offer by some complexly strategic amount. Do you buy at $25, or stay your hand and try to wait for a lower price? Every dollar you save risks losing out altogether.
与荷兰式拍卖或降价拍卖相反的是所谓的“英式拍卖”或“升价拍卖”,这是最常见的拍卖形式。在英式拍卖中,竞标者轮流抬高价格,直到只有一人退出。这似乎更接近我们想要的效果:如果你对一件物品的估价是 25 美元,而我对其估价是 10 美元,那么你只需以略高于 10 美元的价格就能拍下,而无需一路抬价到 25 美元,也无需在竞价策略上陷入僵局。
The inverse of a Dutch or descending auction is what’s known as an “English auction” or “ascending auction”—the most familiar auction format. In an English auction, bidders alternate raising the price until all but one of them drop out. This seems to offer something closer to what we want: here, if you value an item at $25 and I value it at $10, you’ll win it for just over $10 without either having to go all the way to $25 or disappearing down the strategic rabbit hole.
然而,与密封投标拍卖相比,荷兰式拍卖和英式拍卖都增加了额外的复杂性。它们不仅涉及每个竞标者掌握的私人信息,还涉及公开的竞标行为。(在荷兰式拍卖中,正是由于没有出价才揭示了信息,这清楚地表明其他竞标者均未以当前价格水平对该物品进行估价。)在适当的情况下,这种私人数据和公开数据的混合可能会造成危害。
Both the Dutch auction and English auction introduce an extra level of complexity when compared to a sealed-bid auction, however. They involve not only the private information that each bidder has but also the public flow of bidding behavior. (In a Dutch auction, it is the absence of a bid that reveals information, by making it clear that none of the other bidders value the item at the current price level.) And under the right circumstances, this mixing of private and public data can prove toxic.
想象一下,竞标者对自己对一件拍卖品(比如在某片海域钻探石油的权利)价值的估计心存疑虑。正如伦敦大学学院博弈论学家肯·宾莫尔所指出的:“一块地的石油储量对每个人来说都是一样的,但买家对这块地可能蕴藏多少石油的估计,将取决于他们各自不同的地质调查。这类调查不仅成本高昂,而且出了名的不可靠。” 在这种情况下,仔细观察对手的出价,用公开信息来补充自己微薄的私人信息,似乎是理所当然的。
Imagine the bidders are doubtful about their own estimations of the value of an auction lot—say, the right to drill for oil in some part of the ocean. As University College London game theorist Ken Binmore notes, “the amount of oil in a tract is the same for everybody, but the buyers’ estimates of how much oil is likely to be in a tract will depend on their differing geological surveys. Such surveys aren’t only expensive, but notoriously unreliable.” In such a situation, it seems natural to look closely at your opponents’ bids, to augment your own meager private information with the public information.
但这些公开信息可能远不如表面看起来那么有用。你实际上并不知道其他竞标者的信念——你只能了解他们的行为。而且,他们的行为完全有可能基于你自己的行为,就像你的行为受到他们的影响一样。很容易想象一群人一起坠崖,因为“其他人”都表现得好像一切都会好起来——而实际上每个人都心存疑虑,但由于群体中其他人表面上的信心,他们压抑了这些疑虑。
But this public information might not be nearly as informative as it seems. You don’t actually get to know the other bidders’ beliefs—only their actions. And it is entirely possible that their behavior is based on your own, just as your behavior is being influenced by theirs. It’s easy to imagine a bunch of people all going over a cliff together because “everyone else” was acting as though it’d all be fine—when in reality each person had qualms, but suppressed them because of the apparent confidence of everyone else in the group.
正如公地悲剧一样,这种失败并不一定是参与者的错。经济学家苏希尔·比克钱达尼、戴维·赫什莱弗和伊沃·韦尔奇发表的一篇影响深远的论文表明,在特定情况下,一群行为完全理性且完全得当的个体,仍然可能成为实际上无限错误信息的牺牲品。这被称为“信息级联”。
Just as with the tragedy of the commons, this failure is not necessarily the players’ fault. An enormously influential paper by the economists Sushil Bikhchandani, David Hirshleifer, and Ivo Welch has demonstrated that under the right circumstances, a group of agents who are all behaving perfectly rationally and perfectly appropriately can nonetheless fall prey to what is effectively infinite misinformation. This has come to be known as an “information cascade.”
继续以石油钻探权为例,假设有十家公司竞标一块特定地块的开采权。其中一家公司的地质调查表明该地块蕴藏着丰富的石油资源;另一家公司的调查结果尚无定论;其余八家公司的勘察结果表明该地块贫瘠。当然,作为竞争对手,这些公司不会相互分享各自的调查结果,而只能观察彼此的行动。拍卖开始时,第一家公司凭借前景光明的报告,开出了很高的初始出价。第二家公司受此出价的鼓舞,对自己含糊不清的调查结果持乐观态度,出价更高。第三家公司的调查结果并不理想,但现在他们认为两份独立的调查结果都表明该地块蕴藏着金矿,因此不再信任它,于是再次开出高价。第四家公司的调查结果同样不尽如人意,现在他们更加倾向于忽略它,因为似乎他们的三家竞争对手都认为它能赢。于是他们也竞标了。这种“共识”与现实脱节。瀑布已经形成。
To continue the oil drilling rights scenario, imagine there are ten companies that might bid on the rights for a given tract. One of them has a geological survey suggesting the tract is rich with oil; another’s survey is inconclusive; the reconnaissance of the other eight suggests it’s barren. But being competitors, of course, the companies do not share their survey results with each other, and instead can only watch each other’s actions. When the auction begins, the first company, with the promising report, makes a high initial bid. The second company, encouraged by this bid to take an optimistic view of their own ambiguous survey, bids even higher. The third company has a weak survey but now doesn’t trust it in light of what they take to be two independent surveys that suggest it’s a gold mine, so they make a new high bid. The fourth company, which also has a lackluster survey, is now even more strongly inclined to disregard it, as it seems like three of their competitors all think it’s a winner. So they bid too. The “consensus” unglues from reality. A cascade has formed.
没有哪个竞标者的行为是非理性的,但最终结果却是灾难性的。正如赫什莱弗所说:“一旦有人决定不顾自身信息信号,盲目追随前辈,就会发生一件非常重要的事情,那就是他的行动对所有后来的决策者来说都毫无意义。现在,公共信息池不再增长。拥有公共信息所带来的福利效益……已经消失了。”
No single bidder has acted irrationally, yet the net result is catastrophe. As Hirshleifer puts it, “Something very important happens once somebody decides to follow blindly his predecessors independently of his own information signal, and that is that his action becomes uninformative to all later decision makers. Now the public pool of information is no longer growing. That welfare benefit of having public information … has ceased.”
要了解在信息级联占据主导地位的现实世界中会发生什么,并且竞标者几乎只能通过彼此的行为来估计物品的价值,只需看看彼得·A·劳伦斯的发育生物学教科书《苍蝇的诞生》就知道了,该书于 2011 年 4 月在亚马逊的第三方市场上以 23,698,655.93 美元(另加 3.99 美元的运费)的价格售出。这本被公认为备受推崇的书是如何以及为何能达到 2300 多万美元的售价?原来,两个卖家通过算法将他们的价格设置为彼此的常数分数:一个卖家始终将其设置为竞争对手价格的 0.99830 倍,而竞争对手则自动将自己的价格设置为另一个卖家价格的 1.27059 倍。两个卖家似乎都没有想到对最终的数字设置任何限制,最终整个过程完全失控了。
To see what happens in the real world when an information cascade takes over, and the bidders have almost nothing but one another’s behavior to estimate an item’s value, look no further than Peter A. Lawrence’s developmental biology text The Making of a Fly, which in April 2011 was selling for $23,698,655.93 (plus $3.99 shipping) on Amazon’s third-party marketplace. How and why had this—admittedly respected—book reached a sale price of more than $23 million? It turns out that two of the sellers were setting their prices algorithmically as constant fractions of each other: one was always setting it to 0.99830 times the competitor’s price, while the competitor was automatically setting their own price to 1.27059 times the other’s. Neither seller apparently thought to set any limit on the resulting numbers, and eventually the process spiraled totally out of control.
2010年5月6日那场神秘而充满争议的股市“闪电崩盘”中,可能也存在类似的机制。当时,在短短几分钟内,标准普尔500指数中几家看似随机出现的公司股价飙升至每股10万美元以上,而其他一些公司则暴跌,有时跌至每股0.01美元。近1万亿美元的市值瞬间化为乌有。正如CNBC的吉姆·克莱默(Jim Cramer)目瞪口呆地现场报道的那样:“那……不可能是真的。那不是真的价格。好吧,去买宝洁吧!去买宝洁吧,他们公布了一个不错的季度业绩,去买吧……我的意思是,这真是个好机会。”克莱默难以置信的是,他的私人信息竟然能与公开信息相抗衡。在这种情况下,他似乎是世界上唯一一个愿意为市场价值低于 40 美元的股票支付 49 美元的人,但他不在乎;他已经看过季度报告,他对自己所知道的内容很有信心。
It’s possible that a similar mechanism was in play during the enigmatic and controversial stock market “flash crash” of May 6, 2010, when, in a matter of minutes, the price of several seemingly random companies in the S&P 500 rose to more than $100,000 a share, while others dropped precipitously—sometimes to $0.01 a share. Almost $1 trillion of value instantaneously went up in smoke. As CNBC’s Jim Cramer reported live, dumbfounded, “That … it can’t be there. That is not a real price. Oh well, just go buy Procter! Just go buy Procter & Gamble, they reported a decent quarter, just go buy it.… I mean, this is ridi—this is a good opportunity.” Cramer’s incredulity is his private information holding up against the public information. He’s seemingly the only person in the world willing to pay, in this case, $49 for a stock that the market is apparently valuing at under $40, but he doesn’t care; he’s seen the quarterly reports, he’s certain in what he knows.
投资者大致可分为两大阵营:“基本面”投资者,他们根据自己认为的公司潜在价值进行交易;“技术”投资者,他们利用市场波动进行交易。高速算法交易的兴起打破了这两种策略之间的平衡。人们经常抱怨计算机不受商品现实世界价值的制约——它们对将教科书定价为数千万美元和将蓝筹股定价为一美分毫不在意——这加剧了市场的非理性。虽然这种批评通常针对计算机,但人类也会做同样的事情,无数的投资泡沫可以证明这一点。同样,问题往往不在于玩家,而在于游戏本身。
Investors are said to fall into two broad camps: “fundamental” investors, who trade on what they perceive as the underlying value of a company, and “technical” investors, who trade on the fluctuations of the market. The rise of high-speed algorithmic trading has upset the balance between these two strategies, and it’s frequently complained that computers, unanchored to the real-world value of goods—unbothered at pricing a texbook at tens of millions of dollars and blue-chip stocks at a penny—worsen the irrationality of the market. But while this critique is typically leveled at computers, people do the same kind of thing too, as any number of investment bubbles can testify. Again, the fault is often not with the players but with the game itself.
信息瀑布理论不仅为泡沫提供了合理的理论,也为更普遍的时尚和羊群行为提供了合理的理论。它解释了即使在没有非理性、恶意或渎职行为的情况下,任何市场也很容易出现飙升和崩溃。它有几个要点。首先,要警惕公共信息似乎超过私人信息的情况,你对人们在做什么比他们为什么这样做了解更多,你更关心你的判断是否符合共识而不是符合事实。当你主要指望别人来设定路线时,他们很可能也在指望你做同样的事情。其次,记住行动不是信念;当我们根据别人的行为误解他们的想法时,就会引发信息瀑布现象。我们应该尤其谨慎地克制自己的疑虑——如果我们真的这么做了,即使在前进的过程中,我们或许也应该找到某种方式来传播这些疑虑,以免别人无法区分我们内心的不情愿和行动中隐含的热情。最后,我们应该从囚徒困境中汲取教训,记住有时游戏规则可能糟糕得无可救药。一旦身陷其中,我们或许无能为力,但信息级联理论或许能帮助我们从一开始就避免这样的游戏。
Information cascades offer a rational theory not only of bubbles, but also of fads and herd behavior more generally. They offer an account of how it’s easily possible for any market to spike and collapse, even in the absence of irrationality, malevolence, or malfeasance. The takeaways are several. For one, be wary of cases where public information seems to exceed private information, where you know more about what people are doing than why they’re doing it, where you’re more concerned with your judgments fitting the consensus than fitting the facts. When you’re mostly looking to others to set a course, they may well be looking right back at you to do the same. Second, remember that actions are not beliefs; cascades get caused in part when we misinterpret what others think based on what they do. We should be especially hesitant to overrule our own doubts—and if we do, we might want to find some way to broadcast those doubts even as we move forward, lest others fail to distinguish the reluctance in our minds from the implied enthusiasm in our actions. Last, we should remember from the prisoner’s dilemma that sometimes a game can have irredeemably lousy rules. There may be nothing we can do once we’re in it, but the theory of information cascades may help us to avoid such a game in the first place.
如果你是那种无论别人认为多么疯狂,始终坚持做自己认为正确事情的人,那就振作起来。坏消息是,你会比随波逐流的人犯错的次数更多。好消息是,坚持自己的信念会产生积极的外部效应,让人们能够从你的行为中做出准确的推断。也许有一天,你会拯救整个群体于灾难之中。
And if you’re the kind of person who always does what you think is right, no matter how crazy others think it is, take heart. The bad news is that you will be wrong more often than the herd followers. The good news is that sticking to your convictions creates a positive externality, letting people make accurate inferences from your behavior. There may come a time when you will save the entire herd from disaster.
自己计算
To Thine Own Self Compute
计算机科学在博弈论中的应用揭示了,制定策略本身就是我们在相互竞争中付出的代价的一部分——通常是很大一部分。正如递归的困难所表明的那样,没有什么比我们需要了解彼此的想法时付出的代价更高了。在这里,算法博弈论为我们提供了一种重新思考机制设计的方法:不仅要考虑博弈的结果,还要考虑参与者所需的计算工作量。
The application of computer science to game theory has revealed that being obligated to strategize is itself a part—often a big part—of the price we pay in competing with one another. And as the difficulties of recursion demonstrate, nowhere is that price as high as when we’re required to get inside each other’s heads. Here, algorithmic game theory gives us a way to rethink mechanism design: to take into account not only the outcome of the games, but also the computational effort required of the players.
例如,我们已经看到看似无害的拍卖机制可能会遇到各种各样的问题:过度思考、支付过高、失控的连锁反应。但情况并非完全没有希望。事实上,有一种拍卖设计可以像热刀切黄油一样轻松解决心理递归的负担。它被称为维克里拍卖。
We’ve seen how seemingly innocuous auction mechanisms, for instance, can run into all sorts of problems: overthinking, overpaying, runaway cascades. But the situation is not completely hopeless. In fact, there’s one auction design in particular that cuts through the burden of mental recursion like a hot knife through butter. It’s called the Vickrey auction.
维克里拍卖以诺贝尔经济学奖得主威廉·维克里 (William Vickrey) 的名字命名,与首价拍卖类似,是一种“密封投标”拍卖方式。也就是说,每位参与者只需秘密写下一个数字,出价最高者获胜。然而,在维克里拍卖中,获胜者最终支付的金额并非他们自己的出价,而是第二名出价者的出价。也就是说,如果您出价 25 美元,我出价 10 美元,您将以我的价格赢得该物品:您只需支付 10 美元。
Named for Nobel Prize–winning economist William Vickrey, the Vickrey auction, just like the first-price auction, is a “sealed bid” auction process. That is, every participant simply writes down a single number in secret, and the highest bidder wins. However, in a Vickrey auction, the winner ends up paying not the amount of their own bid, but that of the second-place bidder. That is to say, if you bid $25 and I bid $10, you win the item at my price: you only have to pay $10.
对于博弈论者来说,维克里拍卖有许多吸引人的特性。尤其对于算法博弈论者来说,其中一个特性尤为突出:参与者有诚实的动机。事实上,没有比直接出价“真实价值”更好的策略了——也就是你认为物品的实际价值。出价高于真实价值显然是愚蠢的,因为你最终可能会以高于你预期的价格买到东西。而出价低于真实价值(即降低出价)则有可能毫无理由地输掉拍卖,因为它并不能为你省钱——因为即使你赢了,你也只需支付第二高的出价,不管你自己的出价有多高。这使得维克里拍卖被机制设计师称为“策略证明”,或者简称为“诚实”。在维克里拍卖中,诚实实际上是最好的策略。
To a game theorist, a Vickrey auction has a number of attractive properties. And to an algorithmic game theorist in particular, one property especially stands out: the participants are incentivized to be honest. In fact, there is no better strategy than just bidding your “true value” for the item—exactly what you think the item is worth. Bidding any more than your true value is obviously silly, as you might end up stuck buying something for more than you think it’s worth. And bidding any less than your true value (i.e., shading your bid) risks losing the auction for no good reason, since it doesn’t save you any money—because if you win, you’ll only be paying the value of the second-highest bid, regardless of how high your own was. This makes the Vickrey auction what mechanism designers call “strategy-proof,” or just “truthful.” In the Vickrey auction, honesty is literally the best policy.
更妙的是,无论其他竞标者是否诚实,诚实始终是最佳策略。在囚徒困境中,我们看到背叛最终成为“主导”策略——无论你的同伴是背叛还是合作,这都是最佳策略。另一方面,在维克里拍卖中,诚实才是主导策略。这是机制设计者的终极目标。你无需制定策略或进行递归。
Even better, honesty remains the best policy regardless of whether the other bidders are honest themselves. In the prisoner’s dilemma, we saw how defection turned out to be the “dominant” strategy—the best move no matter whether your partner defected or cooperated. In a Vickrey auction, on the other hand, honesty is the dominant strategy. This is the mechanism designer’s holy grail. You do not need to strategize or recurse.
现在,与第一价格拍卖相比,维克里拍卖似乎会让卖家损失一些钱,但这并不一定正确。在第一价格拍卖中,每个竞标者都会降低出价以避免支付过高;在第二价格维克里拍卖中,没有必要这样做——从某种意义上说,拍卖本身就在为他们最优地降低出价。事实上,博弈论中一项名为“收益等价”的原理表明,随着时间的推移,第一价格拍卖的平均预期售价将收敛到与维克里拍卖完全相同的价格。因此,维克里均衡涉及同一个竞标者以相同的价格赢得物品——无需任何竞标者制定任何策略。正如 Tim Roughgarden 告诉他的斯坦福学生的那样,维克里拍卖“棒极了”。
Now, it seems like the Vickrey auction would cost the seller some money compared to the first-price auction, but this isn’t necessarily true. In a first-price auction, every bidder is shading their bid down to avoid overpaying; in the second-price Vickrey auction, there’s no need to—in a sense, the auction itself is optimally shading their bid for them. In fact, a game-theoretic principle called “revenue equivalence” establishes that over time, the average expected sale price in a first-price auction will converge to precisely the same as in a Vickrey auction. Thus the Vickrey equilibrium involves the same bidder winning the item for the same price—without any strategizing by any of the bidders whatsoever. As Tim Roughgarden tells his Stanford students, the Vickrey auction is “awesome.”
对于希伯来大学算法博弈论学家诺姆·尼桑来说,这种令人赞叹的理念近乎乌托邦。“你肯定希望制定一些社会规则,让撒谎变得不值得,这样人们就不会那么爱撒谎了,对吧?这就是基本理念。在我看来,维克里概率论的神奇之处在于,你不会指望它普遍可行,对吧?尤其是在拍卖这种事情上,我当然想少付钱,你怎么可能……而维克里概率论却向我们展示了,这就是实现这一目标的方法。我认为这真的太棒了。”
For Hebrew University algorithmic game theorist Noam Nisan, this awesomeness has an air to it that’s nearly utopian. “You would like to get some kind of rules of society where it’s not worthwhile to lie, and then people won’t lie so much, right? That’s the basic idea. From my point of view, the amazing thing about Vickrey is that you wouldn’t expect that in general it’s possible to do that, right? Especially in things like an auction, where of course I want to pay less, how can you ever get— And then yet Vickrey shows, here is the way to do that. I think that’s really fantastic.”
事实上,这其中的教训远不止拍卖。诺贝尔奖得主罗杰·迈尔森(Roger Myerson)提出了一项里程碑式的发现,即“启示原理”,他证明任何需要策略性掩盖真相的游戏,都可以转变为只需简单诚实的游戏。迈尔森当时的同事保罗·米尔格罗姆(Paul Milgrom)回忆道:“这是一个这样的结果:当你从不同角度看待它时,一方面,它绝对令人震惊和惊叹;另一方面,它又微不足道。这真是太棒了,太神奇了:这就是你知道你正在看到的是你所能看到的最好的东西之一的方式。”
In fact, the lesson here goes far beyond auctions. In a landmark finding called the “revelation principle,” Nobel laureate Roger Myerson proved that any game that requires strategically masking the truth can be transformed into a game that requires nothing but simple honesty. Paul Milgrom, Myerson’s colleague at the time, reflects: “It’s one of those results that as you look at it from different sides, on the one side, it’s just absolutely shocking and amazing, and on the other side, it’s trivial. And that’s totally wonderful, it’s so awesome: that’s how you know you’re looking at one of the best things you can see.”
启示原则表面上看似难以接受,但其证明却相当直观。想象一下,你有一个代理人或律师为你玩游戏。如果你信任他们代表你的利益,你只需告诉他们你想要什么,然后让他们替你处理所有策略性的出价遮蔽和递归策略。在维克里拍卖中,游戏本身就承担了这一功能。启示原则只是扩展了这一理念:任何由你愿意说实话的代理人为你玩的游戏,如果将你期望代理人的行为融入游戏规则本身,那么它就会变成一个诚实至上的游戏。正如尼桑所说:“最基本的是,如果你不想让你的客户对你进行优化,你最好为他们进行优化。这就是全部的证明……如果我设计了一个已经为你优化的算法,你就无能为力了。”
The revelation principle may seem hard to accept on its face, but its proof is actually quite intuitive. Imagine that you have an agent or a lawyer who will be playing the game for you. If you trust them to represent your interests, you’re going to simply tell them exactly what you want, and let them handle all of the strategic bid-shading and the recursive strategizing on your behalf. In the Vickrey auction, the game itself performs this function. And the revelation principle just expands this idea: any game that can be played for you by agents to whom you’ll tell the truth, it says, will become an honesty-is-best game if the behavior you want from your agent is incorporated into the rules of the game itself. As Nisan puts it, “The basic thing is if you don’t want your clients to optimize against you, you’d better optimize for them. That’s the whole proof.… If I design an algorithm that already optimizes for you, there is nothing you can do.”
过去二十年,算法博弈论为众多实际应用做出了巨大贡献:帮助我们理解互联网上的数据包路由,改进分配宝贵(尽管是无形的)公共物品的FCC频谱拍卖,以及增强将医学院学生与医院配对的匹配算法等等。而这很可能只是一场更大变革的开端。“我们才刚刚开始触及皮毛,”尼桑说道。“即使在理论上,我们也才刚刚开始理解它。我今天完全理解的理论,可能还需要一代人的时间才能成功应用于人类。这需要一代人的时间;我认为不会超过一代人。这需要一代人的时间。”
Algorithmic game theory has made huge contributions to a number of practical applications over the past twenty years: helping us understand packet routing on the Internet, improving FCC spectrum auctions that allocate precious (if invisible) public goods, and enhancing the matching algorithms that pair medical students with hospitals, among others. And this is likely just the beginning of a much larger transformation. “We are just scratching the surface,” says Nisan. “Even in the theory we are just starting to understand it. And there is another generation probably until what I completely understand today theoretically will successfully be applied to humans. It’s a generation; I think not more than that. It will take a generation.”
法国存在主义哲学家让-保罗·萨特有句名言:“他人即地狱”。他的意思并非指他人天生恶意或令人不快,而是指他人使我们的思想和信仰变得复杂:
French existentialist philosopher Jean-Paul Sartre famously wrote that “Hell is other people.” He didn’t mean that others are inherently malicious or unpleasant, but rather that they complicate our own thoughts and beliefs:
当我们思考自己,当我们试图认识自己时……我们运用的是别人已有的关于我们自己的知识。我们用别人拥有的和别人给予我们的评判自己的方法来评判自己。无论我说什么,总会有别人的评判介入。无论我内心感受什么,总会有别人的评判介入……但这绝不意味着一个人不能与他人建立关系。它只是凸显了所有其他人对我们每个人至关重要。
When we think about ourselves, when we try to know ourselves … we use the knowledge of us which other people already have. We judge ourselves with the means other people have and have given us for judging ourselves. Into whatever I say about myself someone else’s judgment always enters. Into whatever I feel within myself someone else’s judgment enters.… But that does not at all mean that one cannot have relations with other people. It simply brings out the capital importance of all other people for each one of us.
或许,鉴于我们在本章中所见,我们可以尝试修改萨特的说法。与他人互动不一定是一场噩梦——尽管在错误的游戏中,它肯定会是一场噩梦。正如凯恩斯所观察到的,受欢迎程度复杂难解,就像一座递归的镜厅;但美,在旁观者眼中并非如此。采取一种不需要预测、预判、解读或因他人策略而改变方向的策略,是斩断递归之结的一种方式。有时,这种策略不仅简单易行,而且是最优的。
Perhaps, given what we’ve seen in this chapter, we might endeavor to revise Sartre’s statement. Interacting with others doesn’t have to be a nightmare—although in the wrong game it surely can be. As Keynes observed, popularity is complicated, intractable, a recursive hall of mirrors; but beauty, in the eye of the beholder, is not. Adopting a strategy that doesn’t require anticipating, predicting, reading into, or changing course because of the tactics of others is one way to cut the Gordian knot of recursion. And sometimes that strategy is not just easy—it’s optimal.
如果改变策略无济于事,你可以尝试改变游戏规则。如果这行不通,你至少可以控制一下自己选择玩什么游戏。通往地狱之路充满了棘手的递归、糟糕的均衡和信息瀑布。寻找那些以诚实为主导策略的游戏。然后,做你自己就好。
If changing strategies doesn’t help, you can try to change the game. And if that’s not possible, you can at least exercise some control about which games you choose to play. The road to hell is paved with intractable recursions, bad equilibria, and information cascades. Seek out games where honesty is the dominant strategy. Then just be yourself.
*事实上,它是所有现代计算机的起源——停机问题启发了图灵通过我们现在所说的图灵机正式定义计算。
*Indeed, it’s the origin of all modern computers—it was the halting problem that inspired Turing to formally define computation, via what we now call the Turing machine.
*宾莫尔又提出了另一个见解:像囚徒困境这样的博弈似乎抹杀了伊曼纽尔·康德的论证:理性由他所谓的“绝对命令”构成,即按照你希望别人采取的方式行事。在囚徒困境中,绝对命令会给我们带来比均衡策略更好的结果,但不可回避的事实是,这种结果并非稳定。
*Binmore adds another insight: games like the prisoner’s dilemma seemingly obliterate Immanuel Kant’s argument that rationality consists of what he called the “categorical imperative,” acting the way you wish everyone else would act. The categorical imperative would give us a better outcome in the prisoner’s dilemma than the equilibrium strategy, but there’s no getting around the fact that this outcome isn’t a stable one.
我坚信,人类的重要特征是社会性,而机器将减轻我们目前许多繁重的智力工作,最终将为人类提供时间和动力去学习如何和谐共处。
I firmly believe that the important things about humans are social in character and that relief by machines from many of our present demanding intellectual functions will finally give the human race time and incentive to learn how to live well together.
—梅里尔·弗拉德
—MERRILL FLOOD
任何受空间和时间约束的动态系统都会面临一系列根本且不可避免的核心问题。这些问题本质上是计算性的,这使得计算机不仅是我们的工具,更是我们的伙伴。由此,我们得出了三条简单的智慧。
Any dynamic system subject to the constraints of space and time is up against a core set of fundamental and unavoidable problems. These problems are computational in nature, which makes computers not only our tools but also our comrades. From this come three simple pieces of wisdom.
首先,有些计算机科学家和数学家已经找到了一些好的算法方法,可以简单地迁移到人类问题中。37% 规则、用于处理缓存溢出的“最近最少使用”标准,以及用于指导探索的“置信上限”都是这样的例子。
First, there are cases where computer scientists and mathematicians have identified good algorithmic approaches that can simply be transferred over to human problems. The 37% Rule, the Least Recently Used criterion for handling overflowing caches, and the Upper Confidence Bound as a guide to exploration are all examples of this.
其次,即使没有得到想要的结果,知道自己正在使用最优算法也应该会感到欣慰。37% 规则在 63% 的情况下失效。使用 LRU 维护缓存并不能保证你总能找到想要的内容;事实上,千里眼也不能。使用置信上限方法进行探索/利用权衡并不意味着你不会后悔,只是这些遗憾会随着你的人生经历而逐渐累积。即使是最好的策略有时也会产生糟糕的结果——这就是为什么计算机科学家会小心区分“过程”和“结果”的原因。如果你遵循了最佳的流程,那么你已经尽力了,如果事情没有按你的意愿发展,你不应该责怪自己。
Second, knowing that you are using an optimal algorithm should be a relief even if you don’t get the results you were looking for. The 37% Rule fails 63% of the time. Maintaining your cache with LRU doesn’t guarantee that you will always find what you’re looking for; in fact, neither would clairvoyance. Using the Upper Confidence Bound approach to the explore/exploit tradeoff doesn’t mean that you will have no regrets, just that those regrets will accumulate ever more slowly as you go through life. Even the best strategy sometimes yields bad results—which is why computer scientists take care to distinguish between “process” and “outcome.” If you followed the best possible process, then you’ve done all you can, and you shouldn’t blame yourself if things didn’t go your way.
结果会成为新闻头条——事实上,它构成了我们生活的世界——所以我们很容易被结果所困扰。但过程才是我们能够掌控的。正如伯特兰·罗素所说:“在判断客观正确性时,我们似乎必须考虑概率……客观正确的行为很可能是最幸运的行为。我将其定义为最明智的行为。” 我们可以希望幸运——但我们应该努力变得明智。不妨称之为一种计算斯多葛主义。
Outcomes make news headlines—indeed, they make the world we live in—so it’s easy to become fixated on them. But processes are what we have control over. As Bertrand Russell put it, “it would seem we must take account of probability in judging of objective rightness.… The objectively right act is the one which will probably be most fortunate. I shall define this as the wisest act.” We can hope to be fortunate—but we should strive to be wise. Call it a kind of computational Stoicism.
最后,我们可以清晰地区分那些有直接解决方案的问题和那些没有直接解决方案的问题。如果你最终陷入一个棘手的场景,请记住,启发式方法、近似法以及策略性地运用随机性可以帮助你找到可行的解决方案。在我们与计算机科学家的访谈中,一个反复出现的主题是:有时候“足够好”真的就足够好了。更重要的是,意识到复杂性可以帮助我们选择问题:如果我们能够控制所面临的情况,我们就应该选择那些易于处理的情况。
Finally, we can draw a clear line between problems that admit straightforward solutions and problems that don’t. If you wind up stuck in an intractable scenario, remember that heuristics, approximations, and strategic use of randomness can help you find workable solutions. A theme that came up again and again in our interviews with computer scientists was: sometimes “good enough” really is good enough. What’s more, being aware of complexity can help us pick our problems: if we have control over which situations we confront, we should choose the ones that are tractable.
但我们并非只选择自己提出的问题。我们也选择彼此提出的问题,无论是我们设计城市的方式,还是我们提出问题的方式。这在计算机科学和伦理学之间架起了一座令人惊奇的桥梁——以我们称之为“计算善意”的原则的形式。
But we don’t only pick the problems that we pose to ourselves. We also pick the problems we pose each other, whether it’s the way we design a city or the way we ask a question. This creates a surprising bridge from computer science to ethics—in the form of a principle that we call computational kindness.
* * *
* * *
在安排本书的采访时,我们两人观察到一个悖论。平均而言,当我们提出会面请求时,受访者更有可能有空,例如“下周二下午1:00到2:00(太平洋标准时间)”,而不是“下周某个方便的时间”。乍一看,这似乎很荒谬,就像那些著名的研究表明,人们平均捐款拯救一只企鹅的生命比拯救八千只企鹅的生命更多,或者报告称,他们更担心死于恐怖主义行为,而不是死于任何原因,包括恐怖主义。在采访中,人们似乎更喜欢接受有约束的问题,即使这些约束是凭空捏造的,而不是完全开放的问题。对他们来说,适应我们的偏好和约束似乎比根据他们自己的偏好和约束计算出一个更好的选择更容易。计算机科学家会心领神会地点头,指出“验证”和“搜索”之间存在复杂性差距——这就像听到一首好歌时知道它和当场写一首好歌之间的差距一样大。
There’s a certain paradox the two of us observed when it came to scheduling the interviews that went into this book. Our interviewees were on average more likely to be available when we requested a meeting, say, “next Tuesday between 1:00 and 2:00 p.m. PST” than “at a convenient time this coming week.” At first this seems absurd, like the celebrated studies where people on average donate more money to save the life of one penguin than eight thousand penguins, or report being more worried about dying in an act of terrorism than about dying from any cause, terrorism included. In the case of interviews, it seems that people preferred receiving a constrained problem, even if the constraints were plucked out of thin air, than a wide-open one. It was seemingly less difficult for them to accommodate our preferences and constraints than to compute a better option based on their own. Computer scientists would nod knowingly here, citing the complexity gap between “verification” and “search”—which is about as wide as the gap between knowing a good song when you hear it and writing one on the spot.
计算机科学中有一个隐含的原则,听起来可能有点奇怪,那就是计算是糟糕的:任何优秀算法的根本目的都是尽量减少思考劳动。当我们与他人互动时,我们会向他们提出计算问题——不仅是明确的请求和要求,还有诸如解读我们的意图、信念和偏好等隐含的挑战。因此,从计算的角度理解这些问题,可以揭示人际互动的本质,这合情合理。我们可以通过用一些让底层计算问题更容易理解的方式来构建问题,从而“以计算的方式善待他人”。这一点很重要,因为许多问题——尤其是我们已经看到的社会问题——本质上都是难以解决的。
One of the implicit principles of computer science, as odd as it may sound, is that computation is bad: the underlying directive of any good algorithm is to minimize the labor of thought. When we interact with other people, we present them with computational problems—not just explicit requests and demands, but implicit challenges such as interpreting our intentions, our beliefs, and our preferences. It stands to reason, therefore, that a computational understanding of such problems casts light on the nature of human interaction. We can be “computationally kind” to others by framing issues in terms that make the underlying computational problem easier. This matters because many problems—especially social ones, as we’ve seen—are intrinsically and inextricably hard.
想象一下这个再常见不过的场景。一群朋友聚在一起,琢磨着去哪里吃饭。他们每个人显然都有一些偏好,尽管这些偏好可能比较弱。但他们都不愿明确表达这些偏好,所以他们礼貌地用猜测和半暗示的方式规避社交风险。
Consider this all-too-common scenario. A group of friends are standing around, trying to figure out where to go for dinner. Each of them clearly has some preferences, albeit potentially weak ones. But none of them wants to state those preferences explicitly, so they politely navigate the social hazards with guesses and half-hints instead.
他们或许能达成一个让所有人都满意的解决方案。但这个过程很容易出错。比如,大学毕业后的那个夏天,布莱恩和两个朋友去了西班牙旅行。他们临时商量了行程,但后来发现,他们显然没时间去看他们事先研究和计划好的斗牛了。直到这时,三个人互相安慰时,才突然发现,其实他们一开始就没想去看斗牛。他们只是勇敢地模仿了别人的热情程度,从而也让别人也跟着模仿了同样的热情程度。
They may well come to a resolution that is satisfying to all. But this procedure can easily go awry. The summer after college, for instance, Brian and two friends took a trip to Spain. They negotiated the trip itinerary on the fly, and at one point it became clear that they wouldn’t have time to go to the bullfight they’d researched and planned. Only then, as each of the three attempted to console the others, did they suddenly discover that in fact none of them had wanted to see the bullfight in the first place. Each had just gamely adopted what they’d perceived to be the others’ level of enthusiasm, thereby producing the level of enthusiasm that the others gamely adopted in turn.
同样,像“哦,我很灵活”或“你今晚想做什么?”这样看似无害的语言,却暗藏着计算的阴暗面,值得你三思。它表面上看似友善,却做了两件令人深感担忧的事情。首先,它推卸了认知责任:“这是个问题,你来处理。”其次,通过不表达你的偏好,它鼓励他人去模拟或想象你的偏好。正如我们所见,模拟他人的思维是思维(或机器)所能面临的最大计算挑战之一。
Likewise, seemingly innocuous language like “Oh, I’m flexible” or “What do you want to do tonight?” has a dark computational underbelly that should make you think twice. It has the veneer of kindness about it, but it does two deeply alarming things. First, it passes the cognitive buck: “Here’s a problem, you handle it.” Second, by not stating your preferences, it invites the others to simulate or imagine them. And as we have seen, the simulation of the minds of others is one of the biggest computational challenges a mind (or machine) can ever face.
在这种情况下,计算友善与传统礼仪截然不同。礼貌地隐瞒自己的偏好,会将推断这些偏好的计算问题转嫁给小组其他成员。相比之下,礼貌地表达自己的偏好(“我个人倾向于x。您觉得呢?”)有助于分担推动小组解决问题的认知负担。
In such situations, computational kindness and conventional etiquette diverge. Politely withholding your preferences puts the computational problem of inferring them on the rest of the group. In contrast, politely asserting your preferences (“Personally, I’m inclined toward x. What do you think?”) helps shoulder the cognitive load of moving the group toward resolution.
或者,你可以尝试减少而不是最大化你给其他人的选项数量——比如,提供两三家餐厅而不是十家。如果小组中的每个人都排除自己最不喜欢的选项,那么任务对每个人来说都会更容易。如果你邀请某人共进午餐或安排会议,提供一两个他们可以接受或拒绝的具体建议是一个不错的起点。
Alternatively, you can try to reduce, rather than maximize, the number of options that you give other people—say, offering a choice between two or three restaurants rather than ten. If each person in the group eliminates their least preferred option, that makes the task easier for everyone. And if you’re inviting somebody out to lunch, or scheduling a meeting, offering one or two concrete proposals that they can accept or decline is a good starting point.
这些行为不一定是“礼貌的”,但它们都可以显著降低交互的计算成本。
None of these actions is necessarily “polite,” but all of them can significantly lower the computational cost of interaction.
* * *
* * *
计算善意不仅仅是一种行为原则;它也是一种设计原则。
Computational kindness isn’t just a principle of behavior; it’s also a design principle.
2003年,滑铁卢大学计算机科学家杰弗里·沙利特(Jeffrey Shallit)研究了一个问题:如果哪种硬币在美国流通,最有助于减少平均找零所需的硬币数量。令人欣喜的是,答案竟然是一枚18美分的硬币——但出于计算方面的考虑,沙利特未能提出政策建议。
In 2003, University of Waterloo computer scientist Jeffrey Shallit investigated the question of what coin, if put into circulation in the United States, would most help to minimize the number of coins needed on average to make change. Delightfully, the answer turned out to be an 18-cent piece—but Shallit was somewhat stayed from making a policy recommendation by computational concerns.
目前,找零非常简单:对于任何给定的金额,只要不超过就使用尽可能多的25美分硬币,然后尽可能多地使用10美分硬币,依此类推。例如,54美分是两个25美分硬币,然后是四个1美分硬币。对于18美分硬币,这种简单的算法不再是最佳选择:54美分最好用三个18美分硬币来找零——根本不要用25美分硬币。事实上,Shallit观察到,不美观的面值会使找零变成“至少和旅行商问题一样难”的事情。这对收银员来说要求很高。Shallit发现,如果考虑到计算的便利性,那么美国货币供应最适合使用的要么是2美分硬币,要么是3美分硬币。虽然不如18美分硬币那么令人兴奋——但几乎一样好,而且在计算上更友好得多。
At present, change-making is dead simple: for any given amount, just use as many quarters as you can without going over, then as many dimes as possible, and so on down the denominations. For instance, fifty-four cents is two quarters, then four pennies. With an 18-cent piece, that simple algorithm is no longer optimal: fifty-four cents is then best made with three 18-cent pieces—and no quarters at all. In fact, Shallit observed that ungainly denominations turn change-making into something “at least as hard … as the traveling salesman problem.” That’s a lot to ask of a cashier. If ease of computation is taken into account, Shallit found, then what the US money supply could best make use of is either a 2-cent or a 3-cent piece. Not quite as exciting as an 18-cent coin—but almost as good, and computationally kinder by a long shot.
更深层次的问题是,设计的细微变化可以彻底改变人类用户面临的认知问题。例如,建筑师和城市规划师可以选择如何构建我们的环境——这意味着他们可以选择如何构建我们必须解决的计算问题。
The deeper point is that subtle changes in design can radically shift the kind of cognitive problem posed to human users. Architects and urban planners, for instance, have choices about how they construct our environment—which means they have choices about how they will structure the computational problems we have to solve.
想象一下,一个大型停车场,里面有各种不同的车道,就像体育场馆和购物中心常见的那种。你可能沿着一条车道驶向目的地,看到一个车位,决定放弃它,去寻找(希望)前方更好的车位——但结果却发现运气不佳,到达目的地后,你只能沿着相邻的车道行驶。行驶了一段时间后,你必须决定是找个合适的车位,还是因为太远而不得不尝试在第三条车道上寻找。
Consider a large parking lot, with an array of different lanes, of the kind often found at stadiums and shopping centers. You may drive in one lane toward the destination, see a spot, decide to let it go in favor of (hopefully) a better one farther ahead—but then, finding no such luck, reach the destination and head away down a neighboring lane. After a certain amount of driving, you must decide whether another space is good enough to take, or so far away that you’ll try searching in a third lane instead.
这里的算法视角不仅对驾驶员有用,对建筑师也同样有用。将那些停车场所带来的棘手、混乱的决策问题与一条远离目的地的单一线性路径进行对比。在后者中,人们只需占据第一个可用的停车位——无需博弈论,无需分析,也无需“三思而后行”的规则。一些停车场就是以这种方式构建的,一条螺旋线从地面向上蜿蜒而上。它们的计算负荷为零:人们只需向前行驶,直到出现第一个停车位,然后占据它。无论其他可能支持或反对这种结构的原因是什么,我们可以肯定地说,它对驾驶员来说是认知人性化的——计算上是友好的。
An algorithmic perspective here is useful not just for the driver but also for the architect. Contrast the hairy, messy decision problem posed by one of those lots to a single linear path going away from one’s destination. In that case, one simply takes the first available space—no game theory, no analysis, no look-then-leap rule needed. Some parking garages are structured this way, with a single helix winding upward from the ground level. Their computational load is zero: one simply drives forward until the first space appears, then takes it. Whatever the other possible factors for and against this kind of construction, we can definitely say that it’s cognitively humane to its drivers—computationally kind.
设计的首要目标之一应当是保护人们免受不必要的紧张、摩擦和脑力劳动。(这并非抽象的担忧;例如,当商场停车成为压力源时,购物者可能会减少消费,减少回访。)城市规划师和建筑师通常会权衡不同的停车场设计如何利用有限的空间、材料和资金等资源。但他们很少考虑他们的设计会如何消耗使用者的计算资源。认识到我们日常生活的算法基础——在本例中是最优停车——不仅能让驾驶员在特定场景下做出最佳决策,还能鼓励规划师更加认真地思考他们最初迫使驾驶员面临的问题。
One of the chief goals of design ought to be protecting people from unnecessary tension, friction, and mental labor. (This is not just an abstract concern; when mall parking becomes a source of stress, for instance, shoppers may spend less money and return less frequently.) Urban planners and architects routinely weigh how different lot designs will use resources such as limited space, materials, and money. But they rarely account for the way their designs tax the computational resources of the people who use them. Recognizing the algorithmic underpinnings of our daily lives—in this case, optimal stopping—would not only allow drivers to make the best decisions when they’re in a particular scenario, but also encourage planners to be more thoughtful about the problems they’re forcing drivers into in the first place.
还有许多其他情况也体现了对计算更友好的设计。例如,考虑餐厅的座位策略。有些餐厅实行“开放座位”政策,等待的顾客只需徘徊直到有空位,第一个坐下的人就能得到座位。有些餐厅会记下你的名字,让你在吧台喝一杯,并在有空位时通知你。这些管理稀缺共享资源的方法反映了计算机科学中“旋转”和“阻塞”的区别。当一个处理线程请求资源但无法获取时,计算机可以选择允许该线程“旋转”——继续在永久的“资源准备好了吗?”循环中检查资源——或者选择“阻塞”:暂停该线程,处理其他任务,然后在资源空闲时返回。对计算机科学家来说,这是一种实际的权衡:权衡旋转所损失的时间和上下文切换所损失的时间。但在餐厅,并非所有被交易的资源都是他们自己的。 “旋转”策略可以更快地填满空桌,但与此同时被磨损的 CPU 却是顾客的头脑,陷入了乏味但耗时的警惕之中。
There are a number of other cases where computationally kinder designs suggest themselves. For example, consider restaurant seating policies. Some restaurants have an “open seating” policy, where waiting customers simply hover until a table opens up, and the first to sit down gets the table. Others will take your name, let you have a drink at the bar, and notify you when a table is ready. These approaches to the management of scarce shared resources mirror the distinction in computer science between “spinning” and “blocking.” When a processing thread requests a resource and can’t get it, the computer can either allow that thread to “spin”—to continue checking for the resource in a perpetual “Is it ready yet?” loop—or it can “block”: halt that thread, work on something else, and then come back around whenever the resource becomes free. To a computer scientist, this is a practical tradeoff: weighing the time lost to spinning against the time lost in context switching. But at a restaurant, not all of the resources being traded off are their own. A policy of “spinning” fills empty tables faster, but the CPUs being worn out in the meantime are the minds of their customers, trapped in a tedious but consuming vigilance.
举个类似的例子,考虑一下公交车站带来的计算问题。如果实时显示屏显示下一班车“10分钟后到”,那么你就可以决定是否等待,而不是把公交车持续不来当作一连串的推理证据,一刻一刻地反复考虑。此外,你可以把注意力从眯着眼看路边——原地打转——的十分钟里转移开。(对于那些还没有达到预测下一班车到达要求的城市,我们看到贝叶斯推理甚至可以让了解末班车何时离开成为一个有用的指标。)这种微妙的计算善举,对乘客量的影响,可以与补贴票价一样大,甚至更大:可以将其视为一种认知补贴。
As a parallel example, consider the computational problem posed by a bus stop. If there is a live display saying that the next bus is “arriving in 10 minutes,” then you get to decide once whether to wait, rather than taking the bus’s continued not-coming as a stream of inferential evidence, moment by moment, and having to redecide and redecide. Moreover, you can take your attention away from squinting down the road—spinning—for those ten minutes straight. (For cities that aren’t up to the implementation necessary to predict the next arrival, we saw how Bayesian inference can even make knowing when the last bus left a useful proxy.) Such subtle acts of computational kindness could do as much for ridership, if not more, as subsidizing the fares: think of it as a cognitive subsidy.
* * *
* * *
如果我们能善待他人,我们也能善待自己。这不仅仅是计算上的善待——我们讨论过的所有算法和想法都会对此有所帮助。而且,我们也会更加宽容。
If we can be kinder to others, we can also be kinder to ourselves. Not just computationally kinder—all the algorithms and ideas we have discussed will help with that. But also more forgiving.
理性决策的直观标准是仔细考虑所有可用选项,并选取最佳方案。乍一看,计算机似乎是这种方法的典范,它们会不遗余力地进行复杂的计算,直到得到完美的答案。但正如我们所见,这种对计算机工作的刻板印象已经过时:它只是简单问题所能提供的奢侈。在棘手的情况下,最好的算法在于用最短的时间做出最合理的选择,这绝不意味着要仔细考虑每一个因素,并将每一次计算都进行到底。生活太复杂了,不可能做到这一点。
The intuitive standard for rational decision-making is carefully considering all available options and taking the best one. At first glance, computers look like the paragons of this approach, grinding their way through complex computations for as long as it takes to get perfect answers. But as we’ve seen, that is an outdated picture of what computers do: it’s a luxury afforded by an easy problem. In the hard cases, the best algorithms are all about doing what makes the most sense in the least amount of time, which by no means involves giving careful consideration to every factor and pursuing every computation to the end. Life is just too complicated for that.
在我们考察的几乎每一个领域,我们都发现,我们纳入的现实因素越多——无论是面试求职者时信息不完整,还是试图解决探索/利用困境时应对不断变化的世界,又或是试图完成任务时某些任务依赖于其他任务——我们就越有可能陷入寻找完美解决方案耗时过长的境地。事实上,人们几乎总是面临着计算机科学所谓的“难题”。面对这些难题,有效的算法会做出假设,倾向于选择更简单的解决方案,权衡错误成本和延迟成本,并勇于冒险。
In almost every domain we’ve considered, we have seen how the more real-world factors we include—whether it’s having incomplete information when interviewing job applicants, dealing with a changing world when trying to resolve the explore/exploit dilemma, or having certain tasks depend on others when we’re trying to get things done—the more likely we are to end up in a situation where finding the perfect solution takes unreasonably long. And indeed, people are almost always confronting what computer science regards as the hard cases. Up against such hard cases, effective algorithms make assumptions, show a bias toward simpler solutions, trade off the costs of error against the costs of delay, and take chances.
这些不是我们在无法保持理性时做出的让步,而是保持理性的意义所在。
These aren’t the concessions we make when we can’t be rational. They’re what being rational means.
请注意,一些引用的链接不再有效。
Please note that some of the links referenced are no longer working.
本书印刷版注释的页码未包含在您的电子书中。请使用您电子阅读设备上的搜索功能,查找相关记录或讨论的段落。
The page numbers for the notes that appeared in the print version of this title are not in your e-book. Please use the search function on your e-reading device to search for the relevant passages documented or discussed.
介绍
INTRODUCTION
al-Jabr wa'l-Muqābala : Al-Jabr wa'l-Muqābala带来了一项真正具有颠覆性的技术——印度十进制系统——而我们却错误地将该系统称为阿拉伯数字,这证明了这本书的影响力。阿拉伯数字及其支持的算法的引入,引发了中世纪这场对决,一方是这种新奇数学的倡导者(“算法家”),另一方是更传统的会计师,他们更喜欢用算盘计算的罗马数字(“算盘家”)。这场对决变得非常激烈:佛罗伦萨市于 1399 年通过了一项法律,禁止银行使用阿拉伯数字。具有讽刺意味的是,当罗马数字被用作用文字写出数字的替代品时,它本身就是一项备受争议的创新,它被宣称“不适合表示总和,因为名称就是为此目的而发明的”。请参阅 Murray 的《簿记史章节》 。
al-Jabr wa’l-Muqābala: Al-Jabr wa’l-Muqābala brought with it a truly disruptive technology—the Indian decimal system—and the fact that we refer to this system somewhat erroneously as Arabic numerals is testament to the book’s influence. The introduction of Arabic numerals, and the algorithms they support, kicked off a medieval showdown between the advocates of this newfangled math (the “algorists”) and more traditional accountants who favored Roman numerals backed up by an abacus (the “abacists”). It got pretty intense: the city of Florence passed a law in 1399 that banned the use of Arabic numerals by banks. Ironically, Roman numerals were themselves a controversial innovation when they were offered as an alternative to just writing out numbers with words, being declared “unfitted for showing a sum, since names have been invented for that purpose.” See Murray, Chapters in the History of Bookkeeping.
四千年前的苏美尔泥板: Knuth 在《古巴比伦算法》一书中对此进行了详细分析。Chabert、Barbin 和 Weeks 在《算法史》一书中详细介绍了算法的历史,重点介绍了数学算法。
four-thousand-year-old Sumerian clay tablet: A detailed analysis appears in Knuth, “Ancient Babylonian Algorithms.” Further information on the history of algorithms, with an emphasis on mathematical algorithms, appears in Chabert, Barbin, and Weeks, A History of Algorithms.
用鹿角末端敲击:这种技术被称为“软锤敲击”。
strikes with the end of an antler: This technique is known as “soft hammer percussion.”
“科学是一种思维方式”:萨根,布罗卡的大脑。
“Science is a way of thinking”: Sagan, Broca’s Brain.
我们对人类理性的看法:经典理性概念的局限性——假设无限的计算能力和无限的时间来解决问题——由心理学家、经济学家和人工智能先驱赫伯特·西蒙在 20 世纪 50 年代提出(西蒙,人类模型),最终使他获得了诺贝尔奖。西蒙认为“有限理性”可以更好地解释人类行为。西蒙的见解在数学和计算机科学中得到了呼应。艾伦·图灵的同事 IJ Good(以“奇点”概念和为斯坦利·库布里克提供有关2001:太空漫游的 HAL 9000 的建议而闻名)将这种思维方式称为“第二类理性”。经典的、老式的第一类理性只担心获得正确答案,而第二类理性则考虑获得答案的成本,认识到时间与准确性同样重要。看得好,思考得好。
the way we think about human rationality: The limitations of a classical conception of rationality—which assumes infinite computational capacity and infinite time to solve a problem—were famously pointed out by the psychologist, economist, and artificial intelligence pioneer Herbert Simon in the 1950s (Simon, Models of Man), ultimately leading to a Nobel Prize. Simon argued that “bounded rationality” could provide a better account of human behavior. Simon’s insight has been echoed in mathematics and computer science. Alan Turing’s colleague I. J. Good (famous for the concept of “the singularity” and for advising Stanley Kubrick about HAL 9000 for 2001: A Space Odyssey) called this sort of thinking “Type II Rationality.” Whereas classic, old-fashioned Type I Rationality just worries about getting the right answer, Type II Rationality takes into account the cost of getting that answer, recognizing that time is just as important a currency as accuracy. See Good, Good Thinking.
21 世纪的人工智能专家也认为,“有限最优性”——选择在时间和误差之间取得最佳平衡的算法——是开发功能性智能代理的关键。例如,加州大学伯克利分校的计算机科学家 Stuart Russell(他实际上是人工智能书籍(畅销教科书《人工智能:一种现代方法》)的合著者)和微软研究院院长 Eric Horvitz 都提出了这一观点。例如,请参阅 Russell 和 Wefald 的《做正确的事》以及 Horvitz 和 Zilberstein 的《有限资源下的计算权衡》。Tom 和他的同事已经使用这种方法开发了人类认知模型;请参阅 Griffiths、Lieder 和 Goodman 的《认知资源的合理使用》。
Artificial intelligence experts of the twenty-first century have also argued that “bounded optimality”—choosing the algorithm that best trades off time and error—is the key to developing functional intelligent agents. This is a point made by, for instance, UC Berkeley computer scientist Stuart Russell—who literally cowrote the book on artificial intelligence (the bestselling textbook Artificial Intelligence: A Modern Approach)—and by Eric Horvitz, managing director at Microsoft Research. See, for example, Russell and Wefald, Do the Right Thing, and Horvitz and Zilberstein, “Computational Tradeoffs Under Bounded Resources.” Tom and his colleagues have used this approach to develop models of human cognition; see Griffiths, Lieder, and Goodman, “Rational Use of Cognitive Resources.”
与人类数学家的类比:在图灵的《论可计算数》第9节中,图灵通过将我们如今所称的图灵机的定义与人类可能执行的操作进行比较,证明了其合理性:一张二维的纸变成了一维的磁带,人的思维状态变成了机器的状态,符号随着人或机器在纸上移动而被书写和读取。计算是计算机的工作,而当时唯一的“计算机”就是人。
analogy to a human mathematician: In section 9 of Turing, “On Computable Numbers,” Turing justifies the choices made in defining what we now call a Turing machine by comparing them to operations that a person might carry out: a two-dimensional piece of paper becomes a one-dimensional tape, the person’s state of mind becomes the state of the machine, and symbols are written and read as the person or machine moves around on the paper. Computation is what a computer does, and at the time the only “computers” were people.
我们是非理性的并且容易犯错:例如,参见 Gilovich 的《我们如何知道并非如此》;Ariely 和 Jones 的《怪诞行为学》;以及 Marcus 的《克鲁格》。
we are irrational and error-prone: For example, see Gilovich, How We Know What Isn’t So; Ariely and Jones, Predictably Irrational; and Marcus, Kluge.
1. 最优停止
1. OPTIMAL STOPPING
“尽管所有基督徒都开始”:摘自开普勒 1613 年 10 月 23 日写给“一位不知名的贵族”的信;参见例如 Baumgardt,Johannes Kepler。
“Though all Christians start”: From Kepler’s letter to “an unknown nobleman” on October 23, 1613; see, e.g., Baumgardt, Johannes Kepler.
这种现象很常见:火鸡滴现象在很多地方都有提及,其中包括http://www.npr.org/templates/story/story.php?storyId=120913056和http://jezebel.com/5862181/technology-cant-stop-the-turkey-drop。
such a common phenomenon: The turkey drop is mentioned, among many other places, in http://www.npr.org/templates/story/story.php?storyId=120913056 and http://jezebel.com/5862181/technology-cant-stop-the-turkey-drop.
在任何最佳停止问题中:有关最佳停止的数学知识的更多信息,Ferguson 的《最佳停止和应用》是一本很好的参考书。
In any optimal stopping problem: For more about the mathematics of optimal stopping, Ferguson, Optimal Stopping and Applications, is a wonderful reference.
最佳停止最著名的难题:弗格森在《谁解决了秘书问题?》一书中对秘书问题的性质和起源进行了详细的论述。
optimal stopping’s most famous puzzle: A detailed treatment of the nature and origins of the secretary problem appears in Ferguson, “Who Solved the Secretary Problem?”
首次出版:加德纳所写的是一款名为“古戈尔游戏”的室内游戏,据说是由明尼阿波利斯-霍尼韦尔调节器公司的约翰·福克斯和麻省理工学院的杰拉尔德·马尼于1958年发明的。福克斯在1959年5月11日写给加德纳的信中是这样描述的(我们引用的所有写给加德纳的信均来自马丁·加德纳在斯坦福大学的论文,系列1,盒子5,文件夹19):
its first appearance in print: What Gardner writes about is a parlor game called the “Game of Googol,” apparently devised in 1958 by John Fox of the Minneapolis-Honeywell Regulator Company and Gerald Marnie of MIT. Here’s how it was described by Fox in his original letter to Gardner on May 11, 1959 (all letters to Gardner we quote are from Martin Gardner’s papers at Stanford University, series 1, box 5, folder 19):
第一位玩家在不同的纸条上写下任意数量的唯一正数。然后,他将纸条打乱,并一次翻开一张。如果第二位玩家让他在某张纸条上停下来,并且该纸条上的数字是所有纸条中最大的,则第二位玩家获胜。如果不是,则第一位玩家获胜。
The first player writes down as many unique positive numbers on different slips of paper as he wishes. Then he shuffles them and turns them over one at a time. If the second player tells him to stop at a certain slip and the number on that slip is the largest number in the collection then the second player wins. If not, the first player wins.
福克斯进一步指出,该游戏的名称源于其中一张纸条上经常写着“1 googol”(大概是为了诱使对手认为这是最大的数字,而“2 googol”则出现在其他地方)。他随后声称,第二个玩家的最佳策略是等到一半的纸条被翻开后,选择第一个大于前半部分最大数字的数字,最终获胜的概率为 34.7%。
Fox further noted that the name of the game comes from the fact that the number “one googol” is often written on one of the slips (presumably to trick the opponent into thinking it’s the largest number, with “two googol” appearing somewhere else). He then claimed that the optimal strategy for the second player was to wait until half the slips had been turned over and then choose the first number larger than the largest in the first half, converging on a 34.7% chance of winning.
为了获取更多关于这个问题的信息,加德纳写信给阿尔伯塔大学的数学家利奥·莫泽(Leo Moser)。莫泽曾在1956年发表过一篇期刊论文,探讨一个与之密切相关的问题(莫泽的《论凯莱的一个问题》)。该问题最初由颇具影响力的英国数学家亚瑟·凯莱(Arthur Cayley)于1875年提出(凯莱的《数学问题》;凯莱的《数学论文集》)。以下是凯莱提出的版本:
Gardner wrote to Leo Moser, a mathematician at the University of Alberta, to get more information about the problem. Moser had written a journal article in 1956 that addressed a closely related problem (Moser, “On a Problem of Cayley”), originally proposed in 1875 by the influential British mathematician Arthur Cayley (Cayley, “Mathematical Questions”; Cayley, Collected Mathematical Papers). Here’s the version proposed by Cayley:
彩票的安排如下:有n 张彩票,分别代表a、b、c英镑。一个人抽奖一次;查看他的彩票;如果他愿意,就再抽一次(从剩下的n -1 张彩票中抽);查看他的彩票,如果他愿意,就再抽一次(从剩下的n -2 张彩票中抽);依此类推,总共抽奖不超过k次;他得到的是最后抽出的彩票的金额。假设他根据概率论以对自己最有利的方式安排抽奖,那么他的期望值是多少?
A lottery is arranged as follows: There are n tickets representing a, b, c pounds respectively. A person draws once; looks at his ticket; and if he pleases, draws again (out of the remaining n − 1 tickets); looks at his ticket, and if he pleases draws again (out of the remaining n − 2 tickets); and so on, drawing in all not more than k times; and he receives the value of the last drawn ticket. Supposing that he regulates his drawings in the manner most advantageous to him according to the theory of probabilities, what is the value of his expectation?
莫泽补充了一条信息——彩票取值 0 到 1 之间的任何值的可能性都是相同的。
Moser added one more piece of information—that the tickets were equally likely to take on any value between 0 and 1.
在凯莱问题及其略微重构(有时统称为凯莱-莫泽问题)中,收益是所选彩票的价值,挑战在于找到能够带来最高平均收益的策略。凯莱和莫泽探讨的问题与秘书问题(以及古戈尔游戏)的不同之处在于,他们关注的是最大化所选号码的平均值,而不是找到单个最大号码的概率(因为只有最优号码才能解决问题)。莫泽1956年的论文之所以引人注目,不仅因为它为这个问题提供了简洁的解决方案,还因为它是我们首次看到提及最优停止在现实世界中的影响。莫泽谈到了两种可能的情况:
In Cayley’s problem and Moser’s slight reframing thereof (sometimes collectively referred to as the Cayley-Moser problem), the payoff is the value of the chosen ticket and the challenge is to find the strategy that gives the highest average payoff. It’s here that the problem explored by Cayley and Moser differs from the secretary problem (and the Game of Googol) by focusing on maximizing the average value of the number chosen, rather than the probability of finding the single largest number (when nothing but the best will do). Moser’s 1956 paper is notable not just for the neat solution it provides to this problem, but also because it’s the first place we see mention of the real-world consequences of optimal stopping. Moser talks about two possible scenarios:
1. 游客的问题:一位驾车旅行的游客想在路线指南上列出的n家汽车旅馆中的一家过夜。他想找到最舒适的住宿,但又不想走回头路。他应该以什么标准来选择停留地点?
1. The tourist’s problem: A tourist traveling by car wants to stop for the night at one of n motels indicated on his road guide. He seeks the most comfortable accommodation but naturally does not want to retrace any part of his journey. What criterion should he use for stopping?
2. 单身汉的困境:一个单身汉遇到了一个愿意嫁给他的女孩,而且他也能估量出她的“价值”。如果他拒绝了她,她以后就再也不会理会他了。但他将来很可能会遇到其他女孩,而且他估计自己总共有n个机会。在什么情况下他应该结婚?
2. The bachelor’s dilemma: A bachelor meets a girl who is willing to marry him and whose “worth” he can estimate. If he rejects her she will have none of him later but he is likely to meet other girls in the future and he estimates that he will have n chances in all. Under what circumstances should he marry?
招待一系列追求者(主角性别互换)的想法适时出现在加德纳 1960 年关于 Googol 游戏的专栏中。
The idea of entertaining a series of suitors—with the sexes of the protagonists reversed—duly made an appearance in Gardner’s 1960 column on the Game of Googol.
莫泽向加德纳提供了正确的解决方案——37% 规则,但他在 1959 年 8 月 26 日的信中暗示,这个问题可能有更早的起源:“我还在 RE Gaskell(西雅图波音飞机公司)于 1959 年 1 月分发的一些笔记中发现了这个问题。他将这个问题归功于 G. Marsaglia 博士。”
Moser provided the correct solution—the 37% Rule—to Gardner, but his letter of August 26, 1959, suggested that the problem might have an earlier origin: “I also found it in some notes that R. E. Gaskell (of Boeing Aircraft in Seattle) distributed in January, 1959. He credits the problem to Dr. G. Marsaglia.”
加德纳善意的解读是,福克斯和玛妮声称他们创造了具体的古戈尔游戏,而不是该游戏所代表的更广泛的问题,这一点他在专栏中曾谨慎地提出过。但他收到了各种各样的信件,其中引用了类似问题的早期例子,很明显,这个问题在数学家们之间流传。
Gardner’s charitable interpretation was that Fox and Marnie were claiming the creation of the specific Game of Googol, not of the broader problem of which that game was an instance, a point that was carefully made in his column. But he received a variety of letters citing earlier instances of similar problems, and it’s clear that the problem was passed around among mathematicians.
这个问题的起源出人意料地神秘:就连吉尔伯特和莫斯特勒合著的《识别序列的最大值》(关于秘书问题最权威的科学论文之一)也承认,“寻找这个问题的始作俑者的努力一直未能成功”。弗格森的《谁解决了秘书问题?》一文以有趣且数学上详尽的方式介绍了秘书问题的历史,包括它的一些变体。弗格森认为,事实上加德纳描述的问题并没有得到解决。应该已经很清楚,很多人解决了秘书问题,即从仅以相对排名区分的申请人序列中最大化选出最佳人的概率,但弗格森指出,这实际上并不是古戈尔博弈中提出的问题。首先,古戈尔博弈玩家知道每张纸条上观察到的值。其次,这是一场竞争性游戏——一个玩家试图选择一个能够欺骗另一个玩家的数字和序列。弗格森对这个更具挑战性的问题有自己的解决方案,但它足够复杂,你必须自己阅读论文!
origins of the problem are surprisingly mysterious: Even Gilbert and Mosteller, “Recognizing the Maximum of a Sequence,” one of the most authoritative scientific papers on the secretary problem, admits that “efforts to discover the originator of this problem have been unsuccessful.” Ferguson, “Who Solved the Secretary Problem?,” provides an amusing and mathematically detailed history of the secretary problem, including some of its variants. Ferguson argued that in fact the problem described by Gardner hadn’t been solved. It should already be clear that lots of people solved the secretary problem of maximizing the probability of selecting the best from a sequence of applicants distinguished only by their relative ranks, but Ferguson pointed out that this is not actually the problem posed in the Game of Googol. First of all, the Googol player knows the values observed on each slip of paper. Second, it’s a competitive game—with one player trying to select numbers and a sequence that will deceive the other. Ferguson has his own solution to this more challenging problem, but it’s complex enough that you will have to read the paper yourself!
莫斯特勒回忆起听说过这个问题:吉尔伯特和莫斯特勒,“识别序列的最大值”。
Mosteller recalled hearing about the problem: Gilbert and Mosteller, “Recognizing the Maximum of a Sequence.”
罗格斯大学的罗杰·平克汉姆写道:罗杰·平克汉姆写给马丁·加德纳的信,1960 年 1 月 29 日。
Roger Pinkham of Rutgers wrote: Letter from Roger Pinkham to Martin Gardner, January 29, 1960.
弗勒德对计算机科学的影响:参见库克的《追寻旅行推销员》;庞德斯通的《囚徒困境》;以及弗勒德的《软新闻》。
Flood’s influence on computer science: See Cook, In Pursuit of the Traveling Salesman; Poundstone, Prisoner’s Dilemma; and Flood, “Soft News.”
考虑到自 1949 年以来的问题:弗勒德在 1960 年 5 月 5 日写给加德纳的一封信中提出了这一说法。他附上了 1958 年 5 月 5 日的一封信,其中他提供了正确的解决方案,尽管他也表示,据传安德鲁·格里森、大卫·布莱克威尔和赫伯特·罗宾斯近年来已经解决了这个问题。
considering the problem since 1949: Flood made this claim in a letter he wrote to Gardner on May 5, 1960. He enclosed a letter from May 5, 1958, in which he provided the correct solution, although he also indicated that Andrew Gleason, David Blackwell, and Herbert Robbins were rumored to have solved the problem in recent years.
在 1988 年 5 月 12 日写给汤姆·弗格森的一封信中,弗勒德更详细地讲述了这个问题的起源。(这封信现存于密歇根大学梅里尔·弗勒德档案馆。)他的女儿刚从高中毕业,与一位年长的男人开始了认真的恋爱关系,但弗勒德和他的妻子并不赞同。1950 年 1 月,他的女儿在乔治华盛顿大学的一个会议上做会议记录,弗勒德在那里提出了他所谓的“未婚夫问题”。用他的话说:“我当时并没有试图解决这个问题,只是提出它,因为我希望她能从这个角度思考,而且它听起来像是一个简单的数学小问题。” 弗勒德表示,几年后,在弗勒德自己找到确切解之前,赫伯特·罗宾斯就提供了一个近似解。
In a letter to Tom Ferguson dated May 12, 1988, Flood went into more detail about the origin of the problem. (The letter is on file in the Merrill Flood archive at the University of Michigan.) His daughter, recently graduated from high school, had entered a serious relationship with an older man, and Flood and his wife disapproved. His daughter was taking the minutes at a conference at George Washington University in January 1950, and Flood presented what he called the “fiancé problem” there. In his words, “I made no attempt to solve the problem at that time, but introduced it simply because I hoped that [she] would think in those terms a bit and it sounded like it might be a nice little easy mathematical problem.” Flood indicates that Herbert Robbins provided an approximate solution a few years later, before Flood himself figured out the exact solution.
似乎是在 1964 年的一篇论文中:该论文是 Chow 等人的“基于相对等级的最佳选择”。
appears to be in a 1964 paper: The paper is Chow et al., “Optimal Selection Based on Relative Rank.”
您迄今为止见过的最好的:在文献中,我们所说的“迄今为止最好的”申请人被称为(我们认为有点令人困惑)“候选人”。
the best you’ve seen so far: In the literature, what we call “best yet” applicants are referred to (we think somewhat confusingly) as “candidates.”
最终确定为 37% 的候选人: 37% 规则是通过对n 名申请人进行同样的分析得出的——计算出根据前k 名申请人设定的标准最终选出最佳候选人的概率。这个概率可以用k与n的比率来表示,我们称之为p。随着n 的增大,选择最佳候选人的概率收敛到数学函数 − p log p 。当p = 1/ e时,该概率最大。e的值为2.71828 ... ,所以 1/ e为0.367879441 ...,或略低于 37%。而数学上的巧合——成功的概率与p相同——是因为 log e等于 1。所以如果p = 1/ e,−p log p就是1/ e。弗格森在《谁解决了秘书问题?》一书中对完整推导进行了很好的解释。
settles to 37% of the pool: The 37% Rule is derived by doing the same analysis for n applicants—working out the probability that setting a standard based on the first k applicants results in choosing the best applicant overall. This probability can be expressed in terms of the ratio of k to n, which we can call p. As n gets larger, the probability of choosing the best applicant converges to the mathematical function −p log p. This is maximized when p = 1/e. The value of e is 2.71828…, so 1/e is 0.367879441…, or just under 37%. And the mathematical coincidence—that the probability of success is the same as p—arises because log e is equal to 1. So if p = 1/e, −p log p is just 1/e. A well-explained version of the full derivation appears in Ferguson, “Who Solved the Secretary Problem?”
该问题的一个奇怪的数学对称性:数学家约翰·吉尔伯特和弗雷德里克·莫斯特勒称这种对称性“有趣”,并在吉尔伯特和莫斯特勒的《识别序列的最大值》中对其进行了更详细的讨论。
one of the problem’s curious mathematical symmetries: Mathematicians John Gilbert and Frederick Mosteller call this symmetry “amusing” and discuss it at slightly greater length in Gilbert and Mosteller, “Recognizing the Maximum of a Sequence.”
“两性之间的激情”:马尔萨斯,《人口原理》
“The passion between the sexes”: Malthus, An Essay on the Principle of Population.
“嫁给了我亲吻的第一个男人”:许多来源都这么认为,例如,托马斯,《白宫前排》。
“married the first man I ever kissed”: Attributed by many sources, e.g., Thomas, Front Row at the White House.
一名研究生,寻找爱情:迈克尔·特里克 (Michael Trick) 在与妻子相遇时发表的博客文章是“最佳地寻找爱情”,迈克尔·特里克的运筹学博客,2011 年 2 月 27 日,http://mat.tepper.cmu.edu/blog/? p=1392 。
a graduate student, looking for love: Michael Trick’s blog post on meeting his wife is “Finding Love Optimally,” Michael Trick’s Operations Research Blog, February 27, 2011, http://mat.tepper.cmu.edu/blog/?p=1392.
申请人数量或 时间: 37% 规则仅当申请人在时间上均匀分布时才直接适用于搜索的时间段。否则,您需要更精确地将目标设定为 37% 的时间段分布。请参阅 Bruss 的“一类最佳选择问题的统一方法”。
the number of applicants or the time: The 37% Rule applies directly to the time period of one’s search only when the applicants are uniformly distributed across time. Otherwise, you’ll want to aim more precisely for 37% of the distribution over time. See Bruss, “A Unified Approach to a Class of Best Choice Problems.”
37% 规则给出的年龄是 26.1 岁:至少等到 26 岁才求婚(从 18 岁到 40 岁,已占到 37%)的分析最早出现在 Lindley 的《动态规划和决策理论》中,Trick 大概就是在那里遇到了这个想法。
the 37% Rule gave age 26.1 years: The analysis of waiting until at least age 26 to propose (37% of the way from 18 to 40) first appears in Lindley, “Dynamic Programming and Decision Theory,” which is presumably where Trick encountered this idea.
总共追求过十一位女性:开普勒的故事在库斯特勒的《分水岭》、鲍姆加特的《约翰尼斯·开普勒》以及《开普勒的女巫康纳》中都有详细描述。关于开普勒寻找第二任妻子的记载,我们所知甚少,主要来自一封信。这封信是开普勒在1613年10月23日写给一位来自奥地利林茨的“无名贵族”的。
courting a total of eleven women: Kepler’s story is covered in detail in Koestler, The Watershed, and in Baumgardt, Johannes Kepler, as well as in Connor, Kepler’s Witch. Most of what we know about Kepler’s search for a second wife comes from one letter in particular, which Kepler wrote to “an unknown nobleman” from Linz, Austria, on October 23, 1613.
尽早并经常提出建议:史密斯在“不确定就业的秘书问题”中指出,如果提案被拒绝的概率是q,那么最大限度提高找到最佳申请人的概率的策略是查看等于q 1/(1 − q )的申请人比例,然后向每位申请人提供比目前为止更好的录用通知。这个比例总是小于 1/ e,所以你通过提供更多录用通知来增加你的机会。不幸的是,这些机会仍然比你没有被拒绝时更差——最终找到最佳申请人的概率也是q 1/(1 − q ),因此小于 37% 规则给出的概率。
propose early and often: Smith, “A Secretary Problem with Uncertain Employment,” showed that if the probability of a proposal being rejected is q, then the strategy that maximizes the probability of finding the best applicant is to look at a proportion of applicants equal to q1/(1−q) and then make offers to each applicant better than those seen so far. This proportion is always less than 1/e, so you’re making your chances better by making more offers. Unfortunately, those chances are still worse than if you weren’t getting rejected—the probability of ending up with the best applicant is also q1/(1−q), and hence less than that given by the 37% Rule.
直到你看到 61% 的申请者:如果允许延迟提案,最佳策略取决于立即提案被接受的概率q和延迟提案被接受的概率p。最初被忽略的候选人比例由相当艰巨的公式给出。这个拒绝和召回的综合公式来自 Petruccelli 的“涉及不确定性的最佳选择问题”,尽管杨致远在更早的“识别随机序列的最大值”中就考虑过召回过去的候选人。
until you’ve seen 61% of applicants: If delayed proposals are allowed, the optimal strategy depends on the probability of an immediate proposal being accepted, q, and the probability of a delayed proposal being accepted, p. The proportion of candidates to initially pass over is given by the fairly daunting formula . This integrated formula for rejection and recall comes from Petruccelli, “Best-Choice Problems Involving Uncertainty,” although recalling past candidates was considered earlier by Yang, “Recognizing the Maximum of a Random Sequence.”
当我们对q和p做出特定选择时,此公式会简化。如果p = 0,则延迟的提议总是被拒绝,我们得到了秘书问题(带有拒绝)的规则。当我们接近q = 1 时,立即的提议总是被接受,开始发出要约的比例趋向于e p − 1,该比例始终大于 1/ e(可以重写为e − 1)。这意味着,有可能向已经被接受的申请人发出要约会导致花费更多时间拒绝申请人 - 这是非常直观的。在正文中,我们假设立即的提议总是被接受(q = 1),但延迟的提议有一半的时间被拒绝(p = 0.5)。那么你应该拒绝 61% 的申请人,并向接下来的最佳申请人发出要约,最后再回过头来,如有必要,向总体最佳的申请人发出要约。
This formula simplifies when we make particular choices for q and p. If p = 0, so delayed proposals are always rejected, we get back the rule for the secretary problem with rejection. As we approach q = 1, with immediate proposals always being accepted, the proportion at which to begin making offers tends toward ep−1, which is always greater than 1/e (which can be rewritten as e−1). This means that having the potential to make offers to applicants who have been passed over should result in spending more time passing over applicants—something that is quite intuitive. In the main text we assume that immediate proposals are always accepted (q = 1) but delayed proposals are rejected half the time (p = 0.5). Then you should pass over 61% of applicants and make an offer to the best yet who follows, going back at the end and making an offer to the best overall if necessary.
Petruccelli 考虑的另一种可能性是,由于申请人的热情降低,被拒绝的概率会随着时间的推移而增加。如果申请人接受录用通知的概率为qp s,其中s是联系到该申请人所需的“步骤”数,则最优策略取决于q、p和申请人的数量n。如果q/ (1 − p ) 大于n − 1,那么最好是等待,观察所有申请人,然后向最优者发出录用通知。否则,观察等于q 1/(1 − q )的比例,并向下一个比目前为止更好的申请人发出录用通知。有趣的是,这与p = 0时的策略完全相同(成功概率相同),这意味着如果被拒绝的概率随时间增加,那么回到前一个候选人并没有任何好处。
Another possibility considered by Petruccelli is that the probability of rejection increases with time, as the ardor of applicants decreases. If the probability of an offer being accepted by an applicant is qps, where s is the number of “steps” into the past required to reach that applicant, then the optimal strategy depends on q, p, and the number of applicants, n. If q/(1 − p) is more than n − 1 then it’s best to play a waiting game, observing all applicants and then making an offer to the best. Otherwise, observe a proportion equal to q1/(1−q) and make an offer to the next applicant better than those seen so far. Interestingly, this is exactly the same strategy (with the same probability of success) as that when p = 0, meaning that if the probability of rejection increases with time, there is no benefit to being able to go back to a previous candidate.
“不需要积累经验”: Gilbert 和 Mosteller,《识别序列的最大值》。
“No buildup of experience is needed”: Gilbert and Mosteller, “Recognizing the Maximum of a Sequence.”
使用阈值规则:解决最佳停止问题(如完整信息游戏)的一般策略是从结尾开始并向后推理 - 该原则称为“逆向归纳”。例如,想象一个游戏,你掷一个骰子,可以选择坚持这个数字或最多再掷k次(这个例子取自 Hill 的“知道何时停止”)。最佳策略是什么?我们可以通过逆向推导来找出答案。如果k = 0,则你没有选择 - 你必须坚持你的掷骰结果,平均得分为 3.5 分(掷骰子的平均值,(1 + 2 + 3 + 4 + 5 + 6) / 6)。如果k = 1,那么你应该只保留超过该平均值的掷骰结果 - 4 或更高。如果你掷出 1、2 或 3,你最好尝试最后一次掷骰。按照这个策略,你有 50% 的概率在掷出 4、5 或 6 时停止(平均 5),也有 50% 的概率继续掷到最后一轮(平均 3.5)。所以,在k = 1 时你的平均分数是 4.25,而只有当k = 2 时掷出的分数高于 4.25(即 5 或更高)时,你才应该继续掷下去。以此类推。
use the Threshold Rule: The general strategy for solving optimal stopping problems like the full information game is to start at the end and reason backward—a principle that is called “backward induction.” For instance, imagine a game where you roll a die, and have the option either to stick with that number or roll again a maximum of k times (we took this example from Hill, “Knowing When to Stop”). What’s the optimal strategy? We can figure it out by working backward. If k = 0, you don’t have an option—you have to stick with your roll, and you will average 3.5 points (the average value of a die roll, (1 + 2 + 3 + 4 + 5 + 6)/6). If k = 1, then you should only keep a roll that beats that average—a 4 or higher. If you get a 1, 2, or 3, you’re better off chancing that final roll. Following this strategy, there’s a 50% chance you stop with a 4, 5, or 6 (for an average of 5) and a 50% chance you go on to the final roll (for an average of 3.5). So your average score at k = 1 is 4.25, and you should only keep a roll at k = 2 if it beats that score—a 5 or higher. And so on.
因此,逆向归纳法回答了一个古老的问题。我们说“一鸟在手胜过双鸟在林”,但这里的系数 2.0正确吗?数学表明,林中鸟的正确数量实际上取决于手中鸟的质量。为了方便起见,用骰子代替鸟,掷出 1、2 或 3 的价值甚至不如“在林中”的一个骰子。但掷出 4 值林中一个骰子,而掷出 5 值林中两个、三个甚至四个骰子。掷出 6 的价值甚至超过一丛无限大的骰子——不管那是什么。
Backward induction thus answers an age-old question. “A bird in the hand is worth two in the bush,” we say, but is 2.0 the right coefficient here? The math suggests that the right number of birds in the bush actually depends on the quality of the bird in the hand. Replacing birds with dice for convenience, a roll of 1, 2, or 3 isn’t even worth as much as a single die “in the bush.” But a roll of 4 is worth one die in the bush, while a roll of 5 is worth two, three, or even four dice in the bush. And a roll of 6 is worth even more than the entire contents of an infinitely large dice bush—whatever that is.
Gilbert 和 Mosteller 使用相同的方法推导出在完全信息秘书问题中应该使用的一系列阈值。这些阈值本身并不是用简单的数学公式描述的,但他们的论文中给出了一些近似值。对于申请人 n − k ,最简单的近似值为tk = 1 / ( 1 + 0.804 / k + 0.183/ k2 ) 。如果随机出现一个比申请人n − k更优秀的申请人的概率小于tk ,那么就应该录用该申请人。由于分母会随着k 的增加而以越来越快的速率增加,因此随着时间的推移,你应该迅速降低阈值。
Gilbert and Mosteller used the same approach to derive the series of thresholds that should be used in the full-information secretary problem. The thresholds themselves are not described by a simple mathematical formula, but some approximations appear in their paper. The simplest approximation gives a threshold of tk = 1/(1 + 0.804/k + 0.183/k2) for applicant n − k. If the probability of a random applicant being better than applicant n − k is less than tk, then you should take that applicant. Because the denominator increases—at an increasing rate—as k increases, you should be rapidly lowering your threshold as time goes on.
秘书问题的更多变体: Freeman 的《秘书问题及其扩展》总结了大量此类变体。以下是一些最有用的结果的快速浏览。
many more variants of the secretary problem: Freeman, “The Secretary Problem and Its Extensions” summarizes a large number of these variants. Here’s a quick tour of some of the most useful results.
如果申请人的数量是 1 至n之间的任意数字,则最佳规则是查看前n/e2个候选人(约为n的 13.5%) ,然后选择下一个比目前为止见过的最佳候选人更优秀的候选人,成功率为 2/ e2(Presman 和 Sonin,“随机数对象的最佳选择问题”)。
If the number of applicants is equally likely to be any number from 1 to n, then the optimal rule is to view the first n/e2 (which is approximately 13.5% of n) and take the next candidate better than the best seen so far, with a chance of success of 2/e2 (Presman and Sonin, “The Best Choice Problem for a Random Number of Objects”).
如果申请人的数量可能无限,但搜索在每个申请人之后以概率p停止,则最佳规则是查看前 0.18/ p 个申请人,成功率为 23.6%(同上)。
If the number of applicants is potentially infinite, but the search stops after each applicant with probability p, the optimal rule is to view the first 0.18/p applicants, with a 23.6% chance of success (ibid.).
假设你想找到最好的秘书,但搜索时间越长,找到最佳秘书的价值就越低。如果在查看k名申请人后找到最佳秘书的收益为dk,那么最大化预期收益的策略会根据申请人数量设定一个阈值,并保证随着申请人总数的增加,该阈值小于1/(1- d ) ( Rasmussen和Pliska,“选择最大值”)。如果d接近1,那么近似的最优策略是查看前-0.4348/logd名申请人,然后选择下一个比目前为止更好的候选人。遵循此策略可能会导致无论候选人数量多少,都只能查看少数几个申请人。
Imagine you want to find the best secretary, but the value of doing so decreases the longer you search. If the payoff for finding the best secretary after viewing k applicants is dk, then the strategy that maximizes the expected payoff sets a threshold based on a number of applicants that is guaranteed to be less than 1/(1 − d) as the total number of applicants becomes large (Rasmussen and Pliska, “Choosing the Maximum”). If d is close to 1, then an approximation to the optimal strategy is to view the first −0.4348/log d applicants and then take the next candidate better than any seen so far. Following this strategy can result in viewing only a handful of applicants, regardless of the size of the pool.
现实生活与理想招聘场景的一个不同之处在于,目标可能不是最大化找到最佳秘书的概率。人们探索了各种各样的替代方案。Chow 等人在“基于相对排名的最优选择”中指出,如果目标是最大化选定候选人的平均排名,则适用不同类型的策略。与申请人相对排名的单一阈值不同,存在一系列阈值。随着观察到的候选人越来越多,这些阈值也会随之提高,面试官的要求也会逐渐放松。例如,有四位申请人,候选人停止搜索所需的最低相对排名是:第一位申请人为 0(永远不会停止在第一位),第二位申请人为 1(只有当他们比第一位更好时才停止),第三位申请人为 2(如果是最好或第二好才停止),第四位申请人为 4(赶紧停止!)。遵循此策略可获得 1 7 ⁄ 8的平均预期排名,优于随机抽取申请人的 (1 + 2 + 3 + 4)/4 = 2 1 ⁄ 2。最优阈值的公式是通过逆向归纳法得出的,比较复杂——感兴趣的读者可以参考原文。
One way in which real life differs from idealized recruitment scenarios is that the goal might not be to maximize the probability of getting the best secretary. A variety of alternatives have been explored. Chow et al., “Optimal Selection Based on Relative Rank,” showed that if the goal is to maximize the average rank of the selected candidate, a different kind of strategy applies. Rather than a single threshold on the relative rank of the applicant, there is a sequence of thresholds. These thresholds increase as more candidates are observed, with the interviewer becoming less stringent over time. For example, with four applicants, the minimum relative rank a candidate needs to have to stop the search is 0 for the first applicant (never stop on the first), 1 for the second (stop only if they are better than the first), 2 for the third (stop if best or second best), and 4 for the fourth (just stop already!). Following this strategy yields an average expected rank of 17⁄8, better than the (1 + 2 + 3 + 4)/4 = 21⁄2 that would result from picking an applicant at random. The formula for the optimal thresholds is found by backward induction, and is complicated—we refer interested readers to the original paper.
你可以从如何将收益分配给不同的等级来思考经典秘书问题和平均等级问题之间的区别。在经典秘书问题中,选择最佳人选的收益为 1,其他所有人的收益为 0。在平均等级问题中,收益等于申请人数量减去被选中申请人的等级。有很多显而易见的方法可以推广这一理论,类似于最大化平均等级的多阈值策略,适用于任何收益函数随着申请人等级的提高而降低的策略(Mucci,《关于一类秘书问题》)。另一个有趣的推广——对精明的情侣有着重要的意义——是如果选择最佳人选的收益为 1,而选择其他任何人的收益为 -1(不做任何选择则为 0),你应该从给定比例的申请人中筛选,然后选择第一个比目前为止所有候选人都优秀的人(或者,如果所有候选人都不符合这个标准,则不选任何人)(Sakaguchi,《双边序贯博弈论》)。因此,在准备承诺之前,请认真考虑您的收益函数!
You can think about the difference between the classical secretary problem and the average-rank case in terms of how they assign payoffs to different ranks. In the classical problem, you get a payoff of 1 for picking the best and 0 for everybody else. In the average-rank case, you get a payoff equal to the number of applicants minus the rank of the selected applicant. There are obvious ways to generalize this, and multi-threshold strategies similar to the one that maximizes the average rank work for any payoff function that decreases as the rank of the applicant increases (Mucci, “On a Class of Secretary Problems”). Another interesting generalization—with important implications for discerning lovers—is that if the payoff is 1 for choosing the best but −1 for choosing anybody else (with 0 for making no choice at all), you should go through a proportion of applicants given by , then take the first person better than all seen so far (or nobody if they all fail this criterion) (Sakaguchi, “Bilateral Sequential Games”). So think hard about your payoff function before getting ready to commit!
但是如果你不只是关心找到最好的人,还关心你们在一起的时间有多长呢?Ferguson、Hardwick 和 Tamaki 在“最大化拥有相对最佳对象的持续时间”一文中研究了这个问题的几种变体。如果你只关心最大化你与n 个对象中最好的人在一起的时间,那么你应该看看前 0.204n + 1.33 个人,然后选择下一个比所有人都优秀的人。但是如果你想最大化你与迄今为止见过的所有人中最好的人在一起的时间,你应该只看对应于 1/e2≈13.5% 的比例。这些较短的寻找时间在约会等情况下尤其重要,因为寻找伴侣可能会占据你人生的很大一部分时间。
But what if you don’t just care about finding the best person, but about how much time you have together? Ferguson, Hardwick, and Tamaki, in “Maximizing the Duration of Owning a Relatively Best Object,” examined several variants on this problem. If you just care about maximizing the time you spend with the very best person in your set of n, then you should look at the first 0.204n + 1.33 people and leap for the next person better than all of them. But if you care about maximizing the amount of time you spend with somebody who is the best of all the people seen so far, you should just look at a proportion corresponding to 1/e2 ≈ 13.5%. These shorter looking periods are particularly relevant in contexts—such as dating—where the search for a partner might take up a significant proportion of your life.
事实证明,找到第二好的人比找到最好的人更难。最佳策略是忽略前一半的申请者,然后选择下一个相对于目前为止的申请者而言第二好的申请者(Rose,《最优选择与分配问题》)。成功的概率只有1/4(而最好的概率是1/ e)。所以你最好不要妥协。
It turns out that it’s harder to find the second-best person than it is to find the best. The optimal strategy is to pass over the first half of the applicants, then choose the next applicant who is second best relative to those seen so far (Rose, “A Problem of Optimal Choice and Assignment”). The probability of success is just 1/4 (as opposed to 1/e for the best). So you’re better off not trying to settle.
最后,还有一些变体能够识别出这样一个事实:当你在寻找秘书时,你的求职者本身也在寻找工作。这种新增的对称性——在约会场景中尤其重要——使问题更加复杂。印第安纳大学的认知科学家彼得·托德(Peter Todd)详细探讨了这种复杂性(以及如何简化它)。参见托德和米勒的《从《傲慢与偏见》到伴侣寻找中的说服满足》以及托德的《伴侣寻找中的共同进化认知机制》。
Finally, there are also variants that recognize the fact that while you are looking for a secretary, your applicants are themselves looking for a job. The added symmetry—which is particularly relevant when the scenario concerns dating—makes the problem even more complicated. Peter Todd, a cognitive scientist at Indiana University, has explored this complexity (and how to simplify it) in detail. See Todd and Miller, “From Pride and Prejudice to Persuasion Satisficing in Mate Search,” and Todd, “Coevolved Cognitive Mechanisms in Mate Search.”
卖房的情况类似: Sakaguchi 的《某些顺序抽样设计的动态规划》、Chow 和 Robbins 的《马丁格尔系统定理及其应用》以及 Chow 和 Robbins 的《论最优停止规则》都分析了卖房问题。我们重点关注潜在报价无限多的情况,但这些作者也提供了在潜在报价数量已知且有限的情况下的最优策略(这种策略不太保守——如果机会有限,则应该降低阈值)。在潜在报价数量无限多的情况下,您应该根据等待另一个报价的预期值设置一个阈值,并接受第一个超过该阈值的报价。
Selling a house is similar: The house-selling problem is analyzed in Sakaguchi, “Dynamic Programming of Some Sequential Sampling Design”; Chow and Robbins, “A Martingale System Theorem and Applications”; and Chow and Robbins, “On Optimal Stopping Rules.” We focus on the case where there are potentially infinitely many offers, but these authors also provide optimal strategies when the number of potential offers is known and finite (which are less conservative—you should have a lower threshold if you only have finitely many opportunities). In the infinite case, you should set a threshold based on the expected value of waiting for another offer, and take the first offer that exceeds that threshold.
停止价格作为等待成本的函数:将报价p和等待另一个报价的成本c表示为我们价格范围的分数(0 为范围的底部,1 为顶部),我们的下一个报价优于p的可能性就是 1 − p。如果(或当)出现更好的报价时,我们预期相对于p获得的平均收益就是(1− p ) ⁄ 2。将它们相乘可以得到考虑另一个报价的预期结果,该结果应该大于或等于值得做的 成本c 。这个方程 (1 − p ) ( (1− p ) ⁄ 2 ) ≥ c可以简化为,解p可以得到答案,如下
图所示。
stopping price as a function of the cost of waiting: Expressing both the offer price p and cost of waiting for another offer c as fractions of our price range (with 0 as the bottom of the range and 1 as the top), the chance that our next offer is better than p is simply 1 − p. If (or when) a better offer arrives, the average amount we’d expect to gain relative to p is just (1−p)⁄2. Multiplying these together gives us the expected outcome of entertaining another offer, and this should be greater than or equal to the cost c to be worth doing. This equation (1 − p) ((1−p)⁄2) ≥ c can be simplified to , and solving it for p gives us the answer , as charted here.
“我们收到的第一个报价非常棒”:劳拉·阿尔伯特·麦克莱,个人采访,2014 年 9 月 16 日。
“The first offer we got was great”: Laura Albert McLay, personal interview, September 16, 2014.
模拟人们寻找工作的方式:斯蒂格勒在《信息经济学》和《劳动力市场中的信息》中将求职表述为最优停止问题。麦考尔在《信息与求职经济学》中提出了一个与卖房问题解决方案等价的模型,而利普曼和麦考尔在《求职经济学》中讨论了该模型的几种扩展。正如秘书问题启发了各种各样的变体一样,经济学家也以各种方式改进了这个简单的模型,使其更加符合实际:允许同一天收到多个录用通知、调整卖方的成本以及将求职过程中的经济波动考虑进去。罗杰森、希默和赖特在《劳动力市场的搜索理论模型》中对求职情境中的最佳停止问题进行了很好的回顾。
to model how people look for jobs: The formulation of job search as an optimal stopping problem is dealt with in Stigler, “The Economics of Information,” and Stigler, “Information in the Labor Market.” McCall, “Economics of Information and Job Search,” proposed using a model equivalent to the solution to the house-selling problem, and Lippman and McCall, “The Economics of Job Search,” discusses several extensions to this model. Just as the secretary problem has inspired a vast array of variants, economists have refined this simple model in a variety of ways to make it more realistic: allowing multiple offers to arrive on the same day, tweaking the costs for the seller, and incorporating fluctuation in the economy during the search. A good review of optimal stopping in a job-seeking context can be found in Rogerson, Shimer, and Wright, Search-Theoretic Models of the Labor Market.
现在不会超过你的门槛:正如一项关于求职问题的调查所说:“假设以前被拒绝的录用通知无法被撤回,尽管这实际上并不具有限制性,因为问题是静止的,所以今天不可接受的录用通知明天也不会被接受”(同上)。
won’t be above your threshold now: As a survey of the job-search problem puts it: “Assume previously rejected offers cannot be recalled, although this is actually not restrictive because the problem is stationary, so an offer that is not acceptable today will not be acceptable tomorrow” (ibid.).
“为教职工提供停车位”:克拉克·克尔,引自《教育:从桥上看》,《时代》杂志,1958 年 11 月 17 日。
“parking for the faculty”: Clark Kerr, as quoted in “Education: View from the Bridge,” Time, November 17, 1958.
“预期流量计划”:唐纳德·舒普,私人信件,2013 年 6 月。
“plan on expected traffic”: Donald Shoup, personal correspondence, June 2013.
已在旧金山市中心实施:更多关于旧金山交通局 (SFMTA) 开发的旧金山停车系统及其受舒普启发的动态定价机制的信息,请访问http://sfpark.org/how-it-works/pricing/。(舒普本人也担任顾问。)该项目于 2011 年生效,是全球首个此类项目。有关该项目效果的最新分析,请参阅 Millard-Ball、Weinberger 和 Hampshire 合著的《路边是 80% 满还是 20% 空?》(Is the Curb 80% Full or 20% Empty?)
implemented in downtown San Francisco: More information on the SFpark system developed by the SFMTA, and its Shoup-inspired dynamic pricing, can be found at http://sfpark.org/how-it-works/pricing/. (Shoup himself is involved in an advisory role.) This program began taking effect in 2011, and is the first project of its kind in the world. For a recent analysis of the effects of the program, see Millard-Ball, Weinberger, and Hampshire, “Is the Curb 80% Full or 20% Empty?”
入住率从 90% 上升到 95% 时:唐纳德·舒普,个人采访,2013 年 6 月 7 日。准确地说,入住率从 90% 上升到 95% 意味着增加了 5.555…个百分点。
when occupancy goes from 90% to 95%: Donald Shoup, personal interview, June 7, 2013. To be precise, the increase from 90% to 95% occupancy reflects an increase of 5.555 … percent.
假设你正行驶在一条无限长的道路上:这里表述的基本停车问题,在 DeGroot 的《最优统计决策》一书中被提出来。解决方案是选择距离目的地少于 −log 2 / log(1− p ) 个车位的第一个空位,其中p是任何给定车位可用的概率。
Assume you’re on an infinitely long road: The basic parking problem, as formulated here, was presented as a problem in DeGroot, Optimal Statistical Decisions. The solution is to take the first empty spot less than −log 2 / log(1−p) spots from the destination, where p is the probability of any given space being available.
你无需开始认真寻找:舒普的《免费停车的高成本》第17章讨论了当定价平均每个街区创造一个免费停车位时,最优的路内停车策略。正如舒普所指出的,这“取决于贪婪与懒惰之间的冲突”(个人通信)。舒普在第13章探讨了是“四处寻找”便宜的路内停车位,还是付费使用私人停车位的问题。
you don’t need to start seriously looking: Chapter 17 of Shoup’s The High Cost of Free Parking discusses the optimal on-street parking strategy when pricing creates an average of one free space per block, which, as Shoup notes, “depends on the conflict between greed and sloth” (personal correspondence). The question of whether to “cruise” for cheap on-street spots or to pay for private parking spaces is taken up in Shoup’s chapter 13.
对这一基本场景进行了各种调整: Tamaki 在“某些停车问题的自适应方法”中允许停车位可用概率根据位置而变化,并考虑如何动态估算这些概率。Tamaki 在“带掉头的停车问题中的最佳停车”中增加了掉头的可能性。Tamaki 在“最佳停车问题”中考虑了 DeGroot 模型的扩展,其中停车位不被认为是一组离散的停车位。Sakaguchi 和 Tamaki 在“关于停车位随机出现的最佳停车问题”中使用了这种连续公式,并允许目的地未知。MacQueen 和 Miller 在“最佳持久策略”中独立考虑了该问题的连续版本,允许绕街区行驶。
a variety of tweaks to this basic scenario: Tamaki, “Adaptive Approach to Some Stopping Problems,” allowed the probability of a spot being available to vary based on location and considered how these probabilities could be estimated on the fly. Tamaki, “Optimal Stopping in the Parking Problem with U-Turn,” added the possibility of U-turns. Tamaki, “An Optimal Parking Problem,” considered an extension to DeGroot’s model where parking opportunities are not assumed to be a discrete set of spots. Sakaguchi and Tamaki, “On the Optimal Parking Problem in Which Spaces Appear Randomly,” used this continuous formulation and allowed the destination to be unknown. MacQueen and Miller, “Optimal Persistence Policies,” independently considered a continuous version of the problem that allows circling the block.
“我骑自行车”:唐纳德·舒普,个人访谈,2013 年 6 月 7 日。
“I ride my bike”: Donald Shoup, personal interview, June 7, 2013.
《福布斯》 杂志确认了鲍里斯·别列佐夫斯基的身份: 《福布斯》,“世界亿万富翁”,1997 年 7 月 28 日,第 174 页。
Forbes magazine identified Boris Berezovsky: Forbes, “World’s Billionaires,” July 28, 1997, p. 174.
新一代寡头之一:保罗·克莱布尼科夫,《寡头的崛起》,《福布斯》,2000 年 9 月 9 日。
one of a new class of oligarchs: Paul Klebnikov, “The Rise of an Oligarch,” Forbes, September 9, 2000.
“只打一次,但打在头部”:弗拉基米尔·普京, 2000 年 10 月 26 日接受法国报纸《费加罗报》采访。
“to hit just once, but on the head”: Vladimir Putin, interview with the French newspaper Le Figaro, October 26, 2000.
专门讨论秘书问题的书: Berezovsky 和 Gnedin 的《最佳选择问题》。
book entirely devoted to the secretary problem: Berezovsky and Gnedin, Problems of Best Choice.
以几种不同的形式进行分析:有各种方法可以解决领先时退出的问题。第一种方法是最大化获胜序列的长度。假设你正在抛一枚硬币,正面朝上的概率为p 。每次抛硬币你支付c美元,当正面朝上时你得到 1.00 美元,但当反面朝上时你就会失去所有累积的收益。你应该什么时候停止抛硬币?答案正如诺曼·斯塔尔在 1972 年所展示的,是在r 次正面朝上之后停止,其中r是满足p r + 1 ≤ c的最小数。因此,如果是一枚p = 1/2 的普通硬币,抛硬币的成本为 0.10 美元,那么你应该在连续出现四次正面朝上时停止。对连续正面朝上的分析出现在斯塔尔的《如果必须如何赢得战争》中,它作为赢得消耗战的模型。弗格森在《成功运行期间停止求和》一文中提出了更全面的分析。
analyzed under several different guises: There are various ways to approach the problem of quitting when you’re ahead. The first is maximizing the length of a sequence of wins. Assume you’re tossing a coin that has a probability p of coming up heads. You pay c dollars for each chance to flip the coin, and you get $1.00 when it comes up heads but lose all your accumulated gains when it comes up tails. When should you stop tossing the coin? The answer, as shown by Norman Starr in 1972, is to stop after r heads, where r is the smallest number such that pr+1 ≤ c. So if it’s a regular coin with p = 1/2, and it costs $0.10 to flip the coin, you should stop as soon as you get four heads in a row. The analysis of runs of heads appears in Starr, “How to Win a War if You Must,” where it is presented as a model for winning a war of attrition. A more comprehensive analysis is presented in Ferguson, “Stopping a Sum During a Success Run.”
最大化连续掷硬币的次数,对于某些商业情况来说,是一个非常好的类比——对于一系列交易,其启动成本为c ,成功的概率为p,成功时支付d ,失败时则损失所有收益,你应该在赚到r美元后退出,并且满足p r / d + 1 ≤ c / d。野心勃勃的毒贩们,请注意了。
Maximizing the length of a run of heads is a pretty good analogy for some kinds of business situations—for a sequence of deals that cost c to set up, have a probability p of working out, and pay d on success but wipe out your gains on failure, you should quit after making r dollars such that pr/d+1 ≤ c/d. Ambitious drug dealers, take note.
在文中讨论的窃贼问题中,假设每次抢劫的平均收益为m,逃脱的概率为q。但如果窃贼被抓获(概率为1- q),他将失去一切。解决方案:当累计收益大于或等于mq/ (1- q )时退出。窃贼问题出现在Haggstrom的《需要多次停留时的最佳顺序程序》一文中,它是一个更复杂问题的一部分,其中窃贼还需要决定迁移到哪个城市。
In the burglar problem discussed in the text, assume the average amount gained from each robbery is m and the probability of getting away with the robbery is q. But if the burglar is caught, which happens with probability 1 − q, he loses everything. The solution: quit when the accumulated gains are greater than or equal to mq/(1 − q). The burglar problem appears in Haggstrom, “Optimal Sequential Procedures When More Than One Stop Is Required,” as part of a more complex problem in which the burglar is also trying to decide which city to move to.
被保镖发现:例如,请参阅“鲍里斯·别列佐夫斯基‘被发现脖子上缠着绳索’”,BBC 新闻,2013 年 3 月 28 日,http://www.bbc.com/news/uk-21963080。
found by a bodyguard: See, e.g., “Boris Berezovsky ‘Found with Ligature Around His Neck,’” BBC News, March 28, 2013, http://www.bbc.com/news/uk-21963080.
尸检的官方结论:例如见路透社,“警方称别列佐夫斯基之死与绞刑相符”,2013 年 3 月 25 日,http://www.reuters.com/article/2013/03/25/us-britain-russia-berezovsky-postmortem-idUSBRE92O12320130325。
official conclusion of a postmortem examination: See, e.g., Reuters, “Berezovsky Death Consistent with Hanging: Police,” March 25, 2013, http://www.reuters.com/article/2013/03/25/us-britain-russia-berezovsky-postmortem-idUSBRE92O12320130325.
“别列佐夫斯基不会放弃”:霍夫曼,《寡头》,第 128 页。
“Berezovsky would not give up”: Hoffman, The Oligarchs, p. 128.
没有 最优停止规则:最优停止规则存在的 一个条件是,在最佳可能点停止的平均奖励是有限的(参见 Ferguson 的《最优停止及其应用》)。“三倍或零”游戏违反了这一条件——如果正面出现k次,然后出现一次反面,那么最佳玩家将获得 3 k − 1 的收益,并在反面出现之前停止。这种情况的概率是 1/2 k + 1 。因此, k的平均值是无穷大。
there is no optimal stopping rule: One condition for an optimal stopping rule to exist is that the average reward for stopping at the best possible point be finite (see Ferguson, Optimal Stopping and Applications). The “triple or nothing” game violates this condition—if heads come up k times followed by one tail, the best possible player gets 3k − 1 as a payoff, stopping right before that tail. The probability of this is 1/2k+1. The average over k is thus infinite.
如果你认为这个问题可以通过假设人们拥有的越多,金钱的价值就越低来解决这个问题——即增加三倍的金钱奖励并不一定意味着人们赋予这笔钱的效用也增加三倍——那么有一个简单的变通方法:只需提供效用增加三倍的奖励,你仍然可以得到一个没有最优停止规则的游戏。例如,如果你赋予金钱的效用随金钱数量的对数函数而增加,那么游戏就变成了“立方或零”——每次你赢的时候,你在下一次赌博中可以获得的金额都会增加三倍。
If you’re thinking that this could be resolved by assuming that people value money less the more they have—that tripling the monetary reward may not be tripling the utility people assign to that money—then there’s a simple work-around: you still get a game with no optimal stopping rule just by offering rewards that triple in their utility. For example, if the utility you assign to money increases as a logarithmic function of the amount of money, then the game becomes “cube or nothing”—the amount of money you could receive on the next gamble is raised to the power of three each time you win.
有趣的是,虽然对于“三倍或零”这种赌上全部财产的游戏没有最佳停止规则,但当您可以选择下注多少资金时,还是有一些不错的策略可以玩这种游戏。凯利投注方案以 JL Kelly Jr. 的名字命名,最早在凯利的《信息率的新诠释》中描述,就是一个例子。在这种方案中,玩家可以通过在一系列投注中每次下注其资金的( p ( b + 1) − 1) ⁄ b比例,以概率p获得原始赌注的b + 1 倍的回报,从而最大化他的回报率。对于我们的三倍或零游戏,b = 2 且p = 0.5 ,因此我们每次应该下注四分之一的资金,而不是全部,否则不可避免地会导致破产。庞德斯通的《财富公式》中收录了凯利投注的简史。
Intriguingly, while there is no optimal stopping rule for “triple or nothing,” where your entire fortune is always on the line, there are nonetheless good strategies for playing games like this when you can choose how much of your bankroll to bet. The so-called Kelly betting scheme, named after J. L. Kelly Jr. and first described in Kelly, “A New Interpretation of Information Rate,” is one example. In this scheme, a player can maximize his rate of return by betting a proportion of (p(b+1)−1)⁄b of his bankroll on each of a sequence of bets that pay off b + 1 times the original stake with probability p. For our triple or nothing game, b = 2 and p = 0.5, so we should bet a quarter of our bankroll each time—not the whole thing, which inevitably leads to bankruptcy. An accessible history of Kelly betting appears in Poundstone, Fortune’s Formula.
“人生只有一次”:这句话的出处尚不完全确定,尽管自十九世纪下半叶以来,它就被引用为贵格会的格言,并且似乎至少从 1893 年起就被认为是格雷莱说的。更多信息,请参阅 W. Gurney Benham 的《Benham's Book of Quotations, Proverbs, and Household Words》,1907 年出版。
“pass through this world but once”: The provenance of this quotation is not fully certain, although it has been cited as a Quaker saying since the second half of the nineteenth century, and appears to have been attributed to Grellet since at least 1893. For more, see W. Gurney Benham, Benham’s Book of Quotations, Proverbs, and Household Words, 1907.
“度过下午时光”:迪拉德,《汀克溪朝圣者》。
“Spend the afternoon”: Dillard, Pilgrim at Tinker Creek.
最接近经典的秘书问题: Seale 和 Rapoport,“具有相对等级的顺序决策”。
most closely follows the classical secretary problem: Seale and Rapoport, “Sequential Decision Making with Relative Ranks.”
比应有的更早地跳了起来:同上。人们从观望转向跳转的典型情况是,40 名申请者中有 13 名选择了跳转,80 名申请者中有 21 名选择了跳转,分别占 32% 和 26%。
leapt sooner than they should have: Ibid. The typical place where people switched from looking to leaping was 13 applicants out of 40, and 21 applicants out of 80, or 32% and 26%, respectively.
“我天生非常没有耐心”: Amnon Rapoport,个人采访,2013 年 6 月 11 日。
“by nature I am very impatient”: Amnon Rapoport, personal interview, June 11, 2013.
Seale 和 Rapoport 表明: Seale 和 Rapoport,“具有相对等级的顺序决策”。
Seale and Rapoport showed: Seale and Rapoport, “Sequential Decision Making with Relative Ranks.”
“感到无聊并非不合理”:尼尔·比尔登,私人信件,2013 年 6 月 26 日。另请参阅比尔登的《新秘书问题》。
“It’s not irrational to get bored”: Neil Bearden, personal correspondence, June 26, 2013. See also Bearden, “A New Secretary Problem.”
将所有 决策转化为最优停止:这种论证最初由赫伯特·西蒙提出,这也是他获得诺贝尔奖的贡献之一。西蒙以政治学家的身份开启了他辉煌的职业生涯,当时他撰写的论文主题是或许前景黯淡的行政行为。随着他深入研究由真实个体组成的组织如何进行决策,他对数理经济学提供的抽象决策模型越来越感到不满——这些模型符合理性行动需要全面考虑各种选择的直觉。
turns all decision-making into optimal stopping: This kind of argument was first made by Herbert Simon, and it was one of the contributions for which he received the Nobel Prize. Simon began his remarkable career as a political scientist, writing a dissertation on the perhaps unpromising topic of administrative behavior. As he dug into the problem of understanding how organizations composed of real people make decisions, he experienced a growing dissatisfaction with the abstract models of decision-making offered by mathematical economics—models that line up with the intuition that rational action requires exhaustive consideration of our options.
西蒙对组织决策过程的研究让他清楚地认识到,这些假设是错误的。我们需要一种替代方案。正如他在《理性选择的行为模型》中所说,“我们的任务是用一种理性行为取代经济人的整体理性,这种行为与包括人类在内的有机体在其生存环境中实际拥有的信息获取能力和计算能力相兼容。”
Simon’s investigation of how decisions actually get made in organizations made it clear to him that these assumptions were incorrect. An alternative was needed. As he put it in “A Behavioral Model of Rational Choice,” “the task is to replace the global rationality of economic man with a kind of rational behavior that is compatible with the access to information and the computational capacities that are actually possessed by organisms, including man, in the kinds of environments in which such organisms exist.”
西蒙提出的解决方案是对人类选择的更现实的描述——他称之为“令人满意的”——利用经验设定一个令人满意的“足够好”结果的阈值,然后选择第一个超过该阈值的选项。这种算法与我们这里讨论的最优停止问题的解具有相同的特征,其中阈值要么是通过花费一些时间来了解选项范围(例如秘书问题)来确定的,要么是基于对不同结果概率的了解。事实上,西蒙在他的论证中使用的一个例子就是卖房,其解决方案与这里提出的类似。
The kind of solution that Simon proposed as a more realistic account of human choice—what he dubbed “satisficing”—uses experience to set some threshold for a satisfactory, “good enough” outcome, then takes the first option to exceed that threshold. This algorithm has the same character as the solutions to the optimal stopping problems we have considered here, where the threshold is either determined by spending some time getting a sense for the range of options (as in the secretary problem) or based on knowing the probability of different outcomes. Indeed, one of the examples Simon used in his argument was that of selling a house, with a similar kind of solution to that presented here.
关于最优停止的权威教科书:那就是弗格森的《最优停止及其应用》。
the definitive textbook on optimal stopping: That’s Ferguson, Optimal Stopping and Applications.
2. 探索/利用
2. EXPLORE/EXPLOIT
“结交新朋友”:约瑟夫·帕里,《新朋友和老朋友》,载《美国人民最喜爱的诗歌》 ,哈泽尔·费尔曼编(纽约州花园城:Doubleday,1936 年),第 58 页。
“Make new friends”: Joseph Parry, “New Friends and Old Friends,” in The Best Loved Poems of the American People, ed. Hazel Felleman (Garden City, NY: Doubleday, 1936), 58.
“如此丰富而罕见的生活”:海伦·斯坦纳·赖斯,《友谊花园》,载于《海伦·斯坦纳·赖斯的诗歌与祈祷》,弗吉尼亚·J·鲁尔曼编(密歇根州大急流城:弗莱明·H·雷维尔出版社),第47页。
“life so rich and rare”: Helen Steiner Rice, “The Garden of Friendship,” in The Poems and Prayers of Helen Steiner Rice, ed. Virginia J. Ruehlmann (Grand Rapids, MI: Fleming H. Revell), 47.
“你试图寻找空间”:斯科特·普拉根霍夫,个人访谈,2013 年 9 月 5 日。
“You try to find spaces”: Scott Plagenhoef, personal interview, September 5, 2013.
这个古怪的名字源于:弗雷德里克·莫斯特勒(Frederick Mosteller)在1955年4月14日写给梅里尔·弗勒德(Merrill Flood)的一封信中(可在密歇根大学梅里尔·弗勒德档案馆查阅),讲述了这个名字的由来。莫斯特勒和他的同事罗伯特·布什(Robert Bush)当时正在研究学习的数学模型——这是后来被称为数学心理学的最早例子之一,也为汤姆如今的研究提供了参考。他们对一系列用T形迷宫进行的实验特别感兴趣。实验中,动物被放入T形底部的迷宫中,然后必须决定是向左走还是向右走。食物——也就是奖励——可能会出现在迷宫的两侧,也可能不会出现。为了在人类身上探索这种行为,他们委托制作了一台带有两个可供人拉动的杠杆的机器,莫斯特勒将其命名为“双臂老虎机”。随后,他向同事们介绍了这个问题的数学形式,并最终将其推广到“多臂老虎机”。
The odd name comes from: In a letter to Merrill Flood dated April 14, 1955 (available in the Merrill Flood archive at the University of Michigan), Frederick Mosteller tells the story of the origin of the name. Mosteller and his collaborator Robert Bush were working on mathematical models of learning—one of the earliest instances of what came to be known as mathematical psychology, informing the research that Tom does today. They were particularly interested in a series of experiments that had been done with a T-shaped maze, where animals are put into the maze at the bottom of the T and then have to decide whether to go left or right. Food—the payoff—may or may not appear on either side of the maze. To explore this behavior with humans they commissioned a machine with two levers that people could pull, which Mosteller dubbed the two-armed bandit. He then introduced the mathematical form of the problem to his colleagues, and it ultimately became generalized to the multi-armed bandit.
Berry 和 Fristed 合著的《老虎机问题》一书中对多臂老虎机进行了全面的介绍。本章重点介绍每臂老虎机要么产生收益,要么不产生收益,所有臂的收益概率不同,但所有臂的收益金额相同。这种老虎机在文献中被称为伯努利老虎机,因为描述硬币抛掷的概率分布被称为伯努利分布(以十七世纪瑞士数学家雅各布·伯努利命名)。其他类型的多臂老虎机也是可能的,每臂的收益由不同类型的未知分布来表征。
A comprehensive introduction to multi-armed bandits appears in Berry and Fristed, Bandit Problems. Our focus in this chapter is on bandits where each arm either produces a payoff or doesn’t, with different probabilities but the same payoff amount on all arms. This is known as a Bernoulli bandit in the literature, as the probability distribution that describes a coin flip is called the Bernoulli distribution (after the seventeenth-century Swiss mathematician Jacob Bernoulli). Other kinds of multi-armed bandits are also possible, with unknown distributions of different kinds characterizing the payoffs from each arm.
第二台机器实际上有多好:拉期望值更高的臂的“短视”策略在某些情况下实际上是最优的。Bradt、Johnson 和 Karlin 在“论最大化N 个观测值之和的序贯设计”中指出,如果双臂老虎机(一只臂为p 1,另一只臂为p 2)的收益概率满足p 1 + p 2 = 1,则该策略是最优的。他们推测,这也适用于概率对,其中 ( p 1 , p 2 ) 取值 ( a, b ) 或 ( b, a )(即,如果p 1为a,则p 2为b,反之亦然)。Feldman 在“对“双臂老虎机”问题的贡献”中证明了这一点。 Berry 和 Fristed在《Bandit Problems》中对短视策略进行了进一步的详细说明,其中包括一个结果表明,当p 1和p 2被限制为仅取两个可能值时,选择最高预期值是最佳的(例如, p 1或p 2中的一个或两个可能是 0.4 或 0.7,但我们不知道哪个可能性为真)。
how good the second machine might actually be: The “myopic” strategy of pulling the arm with higher expected value is actually optimal in some cases. Bradt, Johnson, and Karlin, “On Sequential Designs for Maximizing the Sum of N Observations,” showed that if the probabilities of a payoff for a two-armed bandit (with p1 for one arm, p2 for the other) satisfy p1 + p2 = 1, then this strategy is optimal. They conjectured that this also holds for pairs of probabilities where (p1, p2) either take on the values (a, b) or (b, a) (i.e., if p1 is a, then p2 is b, and vice versa). This was proved to be true by Feldman, “Contributions to the ‘Two-Armed Bandit’ Problem.” Berry and Fristed, Bandit Problems, has further details on myopic strategies, including a result showing that choosing the highest expected value is optimal when p1 and p2 are restricted to take on just two possible values (e.g., either or both of p1 or p2 could be 0.4 or 0.7, but we don’t know which of these possibilities is true).
“体现在本质形式中”: Whittle,随时间推移的优化。
“embodies in essential form”: Whittle, Optimization over Time.
“吃、喝、快乐”: “吃、喝、快乐,因为明天我们就要死了”是日常用语和流行文化中的习语(例如,构成戴夫·马修斯乐队的“Tripping Billies”的副歌,以及许多其他引用),似乎是两节圣经经文的混合:传道书 8:15(“人在日光之下,莫强如吃、喝、快乐”)和以赛亚书 22:13(“我们只管吃吃喝喝,因为明天我们就要死了”)。
“Eat, drink, and be merry”: “Eat, drink, and be merry, for tomorrow we die,” an idiom in common parlance and in pop culture (e.g., forming the chorus of “Tripping Billies” by the Dave Matthews Band, among many other references), appears to be a conflation of two biblical verses: Ecclesiastes 8:15 (“A man hath no better thing under the sun, than to eat, and to drink, and to be merry”) and Isaiah 22:13 (“Let us eat and drink, for tomorrow we die”).
“为什么要冒险?”:克里斯·斯图奇奥,个人采访,2013 年 8 月 15 日。
“why take the risk?”: Chris Stucchio, personal interview, August 15, 2013.
“《X战警》第六部”:尼克·艾伦,“好莱坞将2013年打造为续集之年” http://www.telegraph.co.uk/culture/film/film-news/9770154/Hollywood-makes-2013-the-year-of-the-sequel.html。另请参阅http://www.shortoftheweek.com/2012/01/05/has-hollywood-lost-its-way/和http://boxofficemojo.com/news/?id=3063。
“a sixth helping of X-Men”: Nick Allen, “Hollywood makes 2013 the year of the sequel” http://www.telegraph.co.uk/culture/film/film-news/9770154/Hollywood-makes-2013-the-year-of-the-sequel.html. See also http://www.shortoftheweek.com/2012/01/05/has-hollywood-lost-its-way/ and http://boxofficemojo.com/news/?id=3063.
大型电影制片厂的利润下降: “摩根士丹利的本杰明·斯温伯恩说:“2007年至2011年间,大型媒体集团控制的五家电影制片厂(迪士尼、环球影业、派拉蒙、二十世纪福克斯和华纳兄弟)的税前利润下降了约40%。”摘自《好莱坞:分屏》,《经济学人》 ,2013年2月23日,http://www.economist.com/news/business/21572218-tale-two-tinseltowns-split-screens。
Profits of the largest film studios declined: “Between 2007 and 2011, pre-tax profits of the five studios controlled by large media conglomerates (Disney, Universal, Paramount, Twentieth Century Fox and Warner Bros) fell by around 40%, says Benjamin Swinburne of Morgan Stanley.” In “Hollywood: Split Screens,” Economist, February 23, 2013, http://www.economist.com/news/business/21572218-tale-two-tinseltowns-split-screens.
票房收入下降:统计数据来自http://pro.boxoffice.com/statistics/yearly和http://www.the-numbers.com/market/。另请参阅Max Willens,《2014年票房收入:收入跌至三年来最低》,《国际财经时报》,2015年1月5日。
ticket sales have declined: Statistics from http://pro.boxoffice.com/statistics/yearly and http://www.the-numbers.com/market/. See also Max Willens, “Box Office Ticket Sales 2014: Revenues Plunge to Lowest in Three Years,” International Business Times, January 5, 2015.
“在成本上涨的夹缝中挣扎”: “好莱坞:分屏”,《经济学人》 ,2013 年 2 月 23 日,http://www.economist.com/news/business/21572218-tale-two-tinseltowns-split-screens。
“Squeezed between rising costs”: “Hollywood: Split Screens,” Economist, February 23, 2013, http://www.economist.com/news/business/21572218-tale-two-tinseltowns-split-screens.
“智力破坏的终极工具”:惠特尔对老虎机问题难度的评论出现在他对吉廷斯的讨论中,“老虎机过程和动态分配指数”。
“the ultimate instrument of intellectual sabotage”: Whittle’s comment on the difficulty of bandit problems appears in his discussion of Gittins, “Bandit Processes and Dynamic Allocation Indices.”
罗宾斯于 1952 年证明:罗宾斯在《序贯实验设计的一些方面》中介绍了赢-留,输-移算法。
Robbins proved in 1952: Robbins, “Some Aspects of the Sequential Design of Experiments” introduces the Win-Stay, Lose-Shift algorithm.
继罗宾斯之后,一系列论文相继发表:布拉特、约翰逊和卡林合著的《论最大化N个观测值之和的序贯设计》表明,当一个臂的收益概率未知而另一个臂的收益概率已知时,“坚持赢家”原则始终成立。贝里合著的《伯努利双臂老虎机》证明了该原则对于双臂老虎机始终成立。该结果的推广(以及对其不适用情况的描述)收录于贝里和弗里斯特德合著的《老虎机问题》中。
Following Robbins, a series of papers: Bradt, Johnson, and Karlin, “On Sequential Designs for Maximizing the Sum of N Observations,” showed that “stay on a winner” is always true where the probability of a payoff is unknown for one arm but known for the other. Berry, “A Bernoulli Two-Armed Bandit,” proved that the principle is always true for a two-armed bandit. Generalizations of this result (and a characterization of the cases where it doesn’t apply) appear in Berry and Fristed, Bandit Problems.
究竟有多少选项和机会:贝尔曼的巨著《动态规划》提出了“有限视野”版多臂老虎机问题的解决方案。这本书令人印象深刻,因为它是优化和机器学习中许多主题的起点(有时也是终点)。除了其他用途外,动态规划还可以有效地解决需要逆向归纳法的问题——我们在第一章的完全信息博弈中也简要地遇到过这种问题。
exactly how many options and opportunities: This solution to the “finite horizon” version of the multi-armed bandit problem is presented in Bellman’s magnum opus Dynamic Programming, a book that is impressive as the starting point (and sometimes endpoint) of a number of topics in optimization and machine learning. Among other uses, dynamic programming can efficiently solve problems that require backward induction—which we also encountered briefly in chapter 1 in the context of the full-information game.
“顽固不化的代名词”: Gittins《强盗进程和动态分配指数》简介。
“a byword for intransigence”: Introduction to Gittins, “Bandit Processes and Dynamic Allocation Indices.”
“将会是一个非常好的近似值”:约翰·吉廷斯,个人采访,2013 年 8 月 27 日。
“would be a pretty good approximation”: John Gittins, personal interview, August 27, 2013.
《一掷千金》 (Deal or No Deal) :这档游戏节目在全球的多个版本始于2000 年首次播出的荷兰节目《Miljoenenjacht》 。
Deal or No Deal: The many worldwide incarnations of this game show began with the Dutch show Miljoenenjacht, which first aired in 2000.
多臂老虎机问题也不例外:之前的研究人员也已经在固定间隔内找到了这种“单臂老虎机”问题的解决方案(Bellman,“实验顺序设计中的一个问题”;Bradt、Johnson 和 Karlin,“关于最大化N 个观测值总和的顺序设计”)。
the multi-armed bandit problem is no different: Previous researchers had also found solutions for this “one-armed bandit” problem over a fixed interval (Bellman, “A Problem in the Sequential Design of Experiments”; Bradt, Johnson, and Karlin, “On Sequential Designs for Maximizing the Sum of N Observations”).
最大化一个能同时考虑两者的单一数量: Gittins 指数背后的想法最早是在 1972 年的一次会议上提出的,并在会议记录中以 Gittins 和 Jones 的“用于顺序实验设计的动态分配指数”的形式出现,但规范的表达是 Gittins 的“Bandit 过程和动态分配指数”。
maximizing a single quantity that accounts for both: The ideas behind the Gittins index were first presented at a conference in 1972 and appeared in the proceedings as Gittins and Jones, “A Dynamic Allocation Index for the Sequential Design of Experiments,” but the canonical presentation is Gittins, “Bandit Processes and Dynamic Allocation Indices.”
我们提供吉廷斯指数值:伯努利老虎机的吉廷斯指数得分表取自吉廷斯、格雷泽布鲁克和韦伯合著的《多臂老虎机配置指数》,这是一本关于该主题的综合指南。它假设参与者完全不知道收益概率。
we provide the Gittins index values: The table of Gittins index scores for the Bernoulli bandit was taken from Gittins, Glazebrook, and Weber, Multi-Armed Bandit Allocation Indices, which is a comprehensive guide to the topic. It assumes complete ignorance about the probability of a payoff.
驱使我们追求新奇:将这一原则发挥到极致会产生一种简单的策略,称为最小失败规则:始终选择失败次数最少的选项。因此,当你到达一座新城市时,随机挑选一家餐馆。如果它不错,就坚持下去。一旦它不能满足你的要求,就从其他餐馆中随机选择。继续这个过程,直到所有餐馆都一次未能满足你的要求,然后回到成功用餐晚数最多的餐馆并重复。这种策略建立在取胜-停留原则的基础上,如果你是那种耐心的人,认为明天的收益与今天的收益基本一样好,那么它正是 Gittins 指数得出的结果。(该规则出现在 Kelly 的“贴现因子接近于 1 的多臂老虎机”中;正式地说,当贴现率接近于 1 时,它在几何贴现下达到最优。)在一个不断有大量新餐馆开业的大城市里,最小失败政策很简单地说,如果你感到失望,那是因为外面还有太多其他的选择;不要回去。
drives us toward novelty: Taking this to an extreme results in one simple strategy called the Least Failures Rule: always choose the option that’s failed the fewest number of times. So, landing in a new city, pick a restaurant at random. If it is good, stick with it. As soon as it fails to satisfy, choose at random from the other restaurants. Continue this process until all restaurants have failed to satisfy once, then go back to the restaurant with the most nights of successful dining and repeat. This strategy builds on the win-stay principle, and it’s precisely what the Gittins index yields if you’re the patient sort who values tomorrow’s payoff as being essentially as good as today’s. (The rule appears in Kelly, “Multi-Armed Bandits with Discount Factor Near One”; formally, it is optimal under geometric discounting in the limit as the discount rate approaches 1.) In a big city with plenty of new restaurants opening all the time, a Least Failures policy says quite simply that if you’re ever let down, there’s too much else out there; don’t go back.
行为经济学中的各种实验:例如,参见 Kirby 的“竞标未来”。
a variety of experiments in behavioral economics: See, for example, Kirby, “Bidding on the Future.”
如果转换需要成本: Banks 和 Sundaram 在“转换成本和 Gittins 指数”中分析了这一案例。
if there’s a cost to switching: This case is analyzed in Banks and Sundaram, “Switching Costs and the Gittins Index.”
“我有过一些遗憾”:弗兰克·辛纳屈 (Frank Sinatra),《My Way》,出自《My Way》 (1969),歌词由保罗·安卡 (Paul Anka) 创作。
“Regrets, I’ve had a few”: Frank Sinatra, “My Way,” from My Way (1969), lyrics by Paul Anka.
“就我个人而言,我是一个乐观主义者”:温斯顿·丘吉尔首相,1954 年 11 月 9 日伦敦市长宴会上的演讲。印于《丘吉尔,温斯顿·S·丘吉尔:他的全集演讲》中。
“For myself I am an optimist”: Prime Minister Winston Churchill, speech, Lord Mayor’s Banquet, London, November 9, 1954. Printed in Churchill, Winston S. Churchill: His Complete Speeches.
“尝试并失败至少是一种学习”:巴纳德,《高管职能》。
“To try and fail is at least to learn”: Barnard, The Functions of the Executive.
“希望自己能活到 80 岁”:杰夫·贝佐斯,2001 年 5 月 4 日接受成就学院采访,http://www.achievement.org/autodoc/page/bez0int-3。
“wanted to project myself forward to age 80”: Jeff Bezos, interview with the Academy of Achievement, May 4, 2001, http://www.achievement.org/autodoc/page/bez0int-3.
关于遗憾的几个关键点: Lai 和 Robbins,“渐近有效的自适应分配规则”。
several key points about regret: Lai and Robbins, “Asymptotically Efficient Adaptive Allocation Rules.”
保证最小遗憾:同上提供了第一个这样的算法,这些算法后来由 Katehakis 和 Robbins 在“从多个群体中顺序选择”、Agrawal 在“基于样本均值的指数政策”、以及 Auer、Cesa-Bianchi 和 Fischer 在“多臂老虎机问题的有限时间分析”等人的论文中进行了改进。后者提出的可能是此类策略中最简单的,即为臂j分配一个分数,其中s j是该臂n j次游戏中的成功次数, n = Σ j n j是所有臂的总游戏次数。这是成功支付概率的上限(即s j / n j)。选择分数最高的臂可以保证对数遗憾(尽管对此分数进行了一些调整,以便在实践中获得更好的表现)。
the guarantee of minimal regret: Ibid. offered the first such algorithms, which were refined by Katehakis and Robbins, “Sequential Choice from Several Populations”; Agrawal, “Sample Mean Based Index Policies”; and Auer, Cesa-Bianchi, and Fischer, “Finite-Time Analysis of the Multiarmed Bandit Problem,” among others. The latter present perhaps the simplest strategy of this kind, which is to assign arm j a score of , where sj is the number of successes out of nj plays on that arm, and n = Σjnj is the total number of plays of all arms. This is an upper bound on the probability of a successful payoff (which is just sj/nj). Choosing the arm with the highest score guarantees logarithmic regret (although there are tweaks to this score that result in better performance in practice).
又称“置信区间”:置信区间源自奈曼的《统计估计理论概要》。
known as the “confidence interval”: Confidence intervals originate with Neyman, “Outline of a Theory of Statistical Estimation.”
“面对不确定性的乐观主义”: Kaelbling、Littman 和 Moore,《强化学习》。
“optimism in the face of uncertainty”: Kaelbling, Littman, and Moore, “Reinforcement Learning.”
“乐观的机器人”: Leslie Kaelbling,个人访谈,2013 年 11 月 22 日。请参阅 Kaelbling 的《嵌入式系统中的学习》。
“optimistic robots”: Leslie Kaelbling, personal interview, November 22, 2013. See Kaelbling, Learning in Embedded Systems.
5700 万美元额外捐款: Siroker 和 Koomen,A/B 测试。
$57 million of additional donations: Siroker and Koomen, A/B Testing.
A/B 测试的工作原理如下: Christian,《A/B 测试》。Steve Hanov 于 2013 年 8 月 30 日接受个人采访,Noel Welsh 于 2013 年 8 月 27 日接受个人采访。
A/B testing works as follows: Christian, “The A/B Test.” Also informed by Steve Hanov, personal interview, August 30, 2013, and Noel Welsh, personal interview, August 27, 2013.
以奥巴马捐款页面为例: Dan Siroker,《我们如何利用数据赢得总统选举》(讲座),斯坦福大学,2009年5月8日,网址:https://www.youtube.com/watch?v =71bH8z6iqSc。另请参阅Siroker,《奥巴马如何筹集6000万美元》,https://blog.optimizely.com/2010/11/29/how-obama-raised-60-million-by-running-a-simple-experiment/。
In the case of Obama’s donation page: Dan Siroker, “How We Used Data to Win the Presidential Election” (lecture), Stanford University, May 8, 2009, available at https://www.youtube.com/watch?v=71bH8z6iqSc. See also, Siroker, “How Obama Raised $60 Million,” https://blog.optimizely.com/2010/11/29/how-obama-raised-60-million-by-running-a-simple-experiment/.
对用户进行实时 A/B 测试: Google 的首次 A/B 测试于 2000 年 2 月 27 日进行。例如,请参阅 Christian 的“A/B 测试”。
live A/B tests on their users: Google’s first A/B test was run on February 27, 2000. See, e.g., Christian, “The A/B Test.”
公司对其网站导航进行 A/B 测试:例如,参见 Siroker 和 Koomen 的A/B 测试。
Companies A/B test their site navigation: See, e.g., Siroker and Koomen, A/B Testing.
测试了四十一种蓝色:劳拉·M·霍尔森 (Laura M. Holson),《让谷歌更大胆》,《纽约时报》,2009 年 2 月 28 日。
tested forty-one shades of blue: Laura M. Holson, “Putting a Bolder Face on Google,” New York Times, February 28, 2009.
“如何让人们点击广告”: Ashlee Vance,《这次科技泡沫有所不同》,《彭博商业周刊》 ,2011 年 4 月 14 日。http ://www.bloomberg.com/bw/magazine/content/11_17/b4225060960537.htm。
“how to make people click ads”: Ashlee Vance, “This Tech Bubble Is Different,” Bloomberg Businessweek, April 14, 2011. http://www.bloomberg.com/bw/magazine/content/11_17/b4225060960537.htm.
“被疯狂摧毁”:金斯伯格,《嚎叫和其他诗歌》。
“destroyed by madness”: Ginsberg, Howl and Other Poems.
年收入500亿美元:谷歌的财务状况在其季度股东报告中有详细说明。2013年,其广告收入为506亿美元,约占其总收入556亿美元的91%。详情请参阅https://investor.google.com/financial/2013/tables.html。
$50 billion in annual revenue: Google’s finances are detailed in their quarterly shareholder reports. Reported 2013 advertising revenue was $50.6 billion, roughly 91% of total revenue of $55.6 billion. See https://investor.google.com/financial/2013/tables.html.
在线商务规模达数千亿美元: Forrester Research 估计在线销售额。例如,请参阅《福布斯》,2013年3月14日, 《美国在线零售额到2017年将达到3700亿美元;欧洲将达到1910亿欧元》, http://www.forbes.com/sites/forrester/2013/03/14/us-online-retail-sales-to-reach-370b-by-2017-e191b-in-europe/。
online commerce comprises hundreds of billions: Online sales estimated by Forrester Research. See, for instance, “US Online Retail Sales to Reach $370B By 2017; €191B in Europe,” Forbes, 3/14/2013, http://www.forbes.com/sites/forrester/2013/03/14/us-online-retail-sales-to-reach-370b-by-2017-e191b-in-europe/.
关于最佳算法的选择仍然存在激烈争议:例如,Chris Stucchio 撰写了一篇尖锐的文章,题为《为什么多臂老虎机算法优于 A/B 测试》。随后,另一篇同样尖锐的文章《别用老虎机算法——它们可能对你没用》与之对立,文章作者也是 Chris Stucchio。详情请参阅https://www.chrisstucchio.com/blog/2012/bandit_algorithms_vs_ab.html和https://www.chrisstucchio.com/blog/2015/dont_use_bandits.html。 Stucchio 2012 年的帖子部分参考了 Paras Chopra 的一篇文章,标题为“为什么多臂老虎机算法并不比 A/B 测试‘更好’”( https://vwo.com/blog/multi-armed-bandit-algorithm/ ),而该文章本身部分参考了 Steve Hanov 的一篇文章,标题为“每次都能击败 A/B 测试的 20 行代码”( http://stevehanov.ca/blog/index.php?id=132 )。
best algorithms to use remain hotly contested: Chris Stucchio, for instance, penned a cutting article titled “Why Multi-armed Bandit Algorithms Are Superior to A/B Testing,” which was then countered by an equally cutting article called “Don’t Use Bandit Algorithms—They Probably Won’t Work for You”—also written by Chris Stucchio. See https://www.chrisstucchio.com/blog/2012/bandit_algorithms_vs_ab.html and https://www.chrisstucchio.com/blog/2015/dont_use_bandits.html. Stucchio’s 2012 post was written partly in reference to an article by Paras Chopra titled “Why Multi-armed Bandit Algorithm Is Not ‘Better’ than A/B Testing” (https://vwo.com/blog/multi-armed-bandit-algorithm/), which was itself written partly in reference to an article by Steve Hanov titled “20 lines of code that will beat A/B testing every time” (http://stevehanov.ca/blog/index.php?id=132).
它出现在《 华盛顿星报》上: Jean Heller,《梅毒患者未经治疗而死亡》,《华盛顿星报》 ,1972 年 7 月 25 日。
it appeared in the Washington Star: Jean Heller, “Syphilis Patients Died Untreated,” Washington Star, July 25, 1972.
被称为贝尔蒙特报告的文件: 贝尔蒙特报告:保护人类研究受试者的伦理原则和指导方针,1979 年 4 月 18 日。可在http://www.hhs.gov/ohrp/humansubjects/guidance/belmont.html上查阅。
document known as the Belmont Report: The Belmont Report: Ethical principles and guidelines for the protection of human subjects of research, April 18, 1979. Available at http://www.hhs.gov/ohrp/humansubjects/guidance/belmont.html.
提出进行“适应性”试验:参见泽伦的《赢家规则与对照临床试验》。虽然这是一个激进的想法,但泽伦并非第一个提出它的人。这项荣誉属于耶鲁大学病理学院的讲师威廉·R·汤普森,他提出了如何确定一种治疗方法是否比另一种更有效的问题,并于1933年提出了自己的解决方案(汤普森,《论一个未知概率超过另一个概率的可能性》)。
proposed conducting “adaptive” trials: See Zelen, “Play the Winner Rule and the Controlled Clinical Trial.” While this was a radical idea, Zelen wasn’t the first to propose it. That honor goes to William R. Thompson, an instructor in the School of Pathology at Yale, who formulated the problem of identifying whether one treatment is more effective than another, and proposed his own solution, in 1933 (Thompson, “On the Likelihood That One Unknown Probability Exceeds Another”).
汤普森提出的解决方案是随机抽样选项,其中选择一个选项的概率对应于根据迄今为止观察到的证据得出最佳选项的概率,这是机器学习中关于这一问题的大量近期研究的基础(我们将在第 9 章中讨论随机性和抽样的算法用途)。
The solution that Thompson proposed—randomly sampling options, where the probability of choosing an option corresponds to the probability that it is the best based on the evidence observed so far—is the basis for much recent work on this problem in machine learning (we return to the algorithmic uses of randomness and sampling in chapter 9).
弗雷德里克·莫斯特勒(Frederick Mosteller)和赫伯特·罗宾斯(Herbert Robbins)在开始研究双臂老虎机问题时,似乎都不知道汤普森的工作。几年后,理查德·贝尔曼(Richard Bellman)发现了这些“鲜为人知的论文”,并指出:“我们承认,我们是通过常规方式发现这些论文的,也就是在翻阅一本包含另一篇感兴趣论文的期刊时发现的”(贝尔曼,《序贯实验设计中的一个问题》)。
Neither Frederick Mosteller nor Herbert Robbins seemed to be aware of Thompson’s work when they started to work on the two-armed bandit problem. Richard Bellman found the “little-known papers” a few years later, noting that “We confess that we found these papers in the standard fashion, namely while thumbing through a journal containing another paper of interest” (Bellman, “A Problem in the Sequential Design of Experiments”).
ECMO 挽救了一名新生女婴的生命:密歇根大学外科系,“ECMO 婴儿的‘希望’”,http://surgery.med.umich.edu/giving/stories/ecmo.shtml。
ECMO saved the life of a newborn girl: University of Michigan Department of Surgery, “‘Hope’ for ECMO Babies,” http://surgery.med.umich.edu/giving/stories/ecmo.shtml.
现在已经庆祝了她的四十岁生日:密歇根大学健康系统,“UM Health System ECMO 团队治疗第 2,000 名患者”,2011 年 3 月 1 日,http://www.uofmhealth.org/news/ECMO%202000th%20patient。
has now celebrated her fortieth birthday: University of Michigan Health System, “U-M Health System ECMO team treats its 2,000th patient,” March 1, 2011, http://www.uofmhealth.org/news/ECMO%202000th%20patient.
成人早期研究: Zapol 等人,“体外膜氧合在严重急性呼吸衰竭中的作用。”
early studies in adults: Zapol et al., “Extracorporeal Membrane Oxygenation in Severe Acute Respiratory Failure.”
一项针对新生儿的研究: Bartlett 等人,“新生儿呼吸衰竭的体外循环”。
a study on newborns: Bartlett et al., “Extracorporeal Circulation in Neonatal Respiratory Failure.”
“没有证明常规使用 ECMO 是合理的”:引自 Ware 的《研究具有潜在巨大益处的疗法:ECMO》,参考了 Ware 和 Epstein 的《关于‘新生儿呼吸衰竭的体外循环’的评论》中的结论,而这又是对 Bartlett 等人的《新生儿呼吸衰竭的体外循环》的评论。
“did not justify routine use of ECMO”: Quotation from Ware, “Investigating Therapies of Potentially Great Benefit: ECMO,” referring to conclusions in Ware and Epstein, “Comments on ‘Extracorporeal Circulation in Neonatal Respiratory Failure,’” which is in turn a comment on Bartlett et al., “Extracorporeal Circulation in Neonatal Respiratory Failure.”
“从伦理上很难为进一步的随机化辩护”: Ware,“研究具有潜在巨大益处的疗法:ECMO。”
“difficult to defend further randomization ethically”: Ware, “Investigating Therapies of Potentially Great Benefit: ECMO.”
世界顶尖专家之一:贝里在其1971年的博士论文中证明了,坚持使用获胜者是最佳策略。该论文以贝里论文《伯努利双臂强盗》为题发表。
one of the world’s leading experts: It was Berry, in his 1971 PhD dissertation, who proved that staying on a winner is optimal. The result was published as Berry, “A Bernoulli Two-Armed Bandit.”
“不应该进行Ware研究”: Berry,“评论:伦理与ECMO。”
“Ware study should not have been conducted”: Berry, “Comment: Ethics and ECMO.”
英国近两百名婴儿:英国 ECMO 合作小组,“英国 ECMO 合作试验”。
nearly two hundred infants in the United Kingdom: UK Collaborative ECMO Group, “The Collaborative UK ECMO Trial.”
多种癌症治疗的临床试验: Don Berry,个人访谈,2013 年 8 月 22 日。
clinical trials for a variety of cancer treatments: Don Berry, personal interview, August 22, 2013.
FDA发布了一份“指导”文件: FDA 2010年2月的《药物和生物制剂的自适应设计临床试验》可以在http://www.fda.gov/downloads/Drugs/Guidances/ucm201790.pdf找到。
the FDA released a “guidance” document: The FDA’s “Adaptive Design Clinical Trials for Drugs and Biologics” from February 2010 can be found at http://www.fda.gov/downloads/Drugs/Guidances/ucm201790.pdf.
显示一个带有两盏灯的盒子:这项研究出现在 Tversky 和 Edwards 的“二元选择中的信息与奖励”中。
shown a box with two lights on it: The study appears in Tversky and Edwards, “Information Versus Reward in Binary Choices.”
两家航空公司: Meyer 和 Shi,“模糊性下的顺序选择”。
two airlines: Meyer and Shi, “Sequential Choice Under Ambiguity.”
使用四臂老虎机进行的实验: Steyvers、Lee 和 Wagenmakers,“对老虎机问题中人类决策的贝叶斯分析”。
an experiment with a four-armed bandit: Steyvers, Lee, and Wagenmakers, “A Bayesian Analysis of Human Decision-Making on Bandit Problems.”
所谓的“不安分的强盗”: Whittle在其著作《不安分的强盗》中引入了不安分的强盗,该著作探讨了一种类似于Gittins指数的策略,在某些情况下可以使用。Papadimitriou和Tsitsiklis在其著作《最优排队网络控制的复杂性》中探讨了不安分的强盗带来的计算挑战,以及随之而来的对有效最优解的悲观情绪。
what has been termed a “restless bandit”: Restless bandits were introduced by Whittle, “Restless Bandits,” which discusses a strategy similar to the Gittins index that can be used in some cases. The computational challenges posed by restless bandits—and the consequent pessimism about efficient optimal solutions—are discussed in Papadimitriou and Tsitsiklis, “The Complexity of Optimal Queuing Network Control.”
当世界可以改变时:纳瓦罗和纽厄尔的《变化世界中的信息与奖励》提供了最近的研究结果,支持了这样一种观点:人类的过度探索是由于假设世界是不安分的。
when the world can change: Navarro and Newell, “Information Versus Reward in a Changing World,” provides recent results supporting the idea that human over-exploration is a result of assuming the world is restless.
“事实上存在着一种和谐”:梭罗,《行走》。
“There is in fact a sort of harmony”: Thoreau, “Walking.”
“可乐就是可乐”:沃霍尔,安迪·沃霍尔的哲学。
“A Coke is a Coke”: Warhol, The Philosophy of Andy Warhol.
“一种解决探索/利用权衡的发展方式”:艾莉森·戈普尼克,个人访谈,2013 年 8 月 22 日。另请参阅戈普尼克的《婴儿床上的科学家》。
“a developmental way of solving the exploration/exploitation tradeoff”: Alison Gopnik, personal interview, August 22, 2013. See also Gopnik, The Scientist in the Crib.
“我阅读生涯中的一个转折点”:莉迪亚·戴维斯,《有人在读书》,《不能和不会:故事》。
“a juncture in my reading life”: Lydia Davis, “Someone Reading a Book,” Can’t and Won’t: Stories.
挑战我们对变老的先入之见:卡斯滕森的《成年期的社会和情感模式》提出了我们在本节中讨论的基本“社会情感选择性理论”,以及一些证据。
challenging our preconceptions about getting older: Carstensen, “Social and Emotional Patterns in Adulthood” presents the basic “socioemotional selectivity theory” we discuss in this section, as well as some of the evidence for it.
“终身选择过程”:同上。
“lifelong selection processes”: Ibid.
即将搬到全国各地: Fredrickson 和 Carstensen,“选择社会伙伴”。
about to move across the country: Fredrickson and Carstensen, “Choosing Social Partners.”
他们的偏好变得难以区分: Fung、Carstensen 和 Lutz,《时间对社会偏好的影响》。
their preferences became indistinguishable: Fung, Carstensen, and Lutz, “Influence of Time on Social Preferences.”
老年人通常更加满意: Charles 和 Carstensen 在《社会和情感老龄化》中讨论了随着年龄增长情绪健康得到改善的证据。
older people are generally more satisfied: Evidence of improvements in emotional well-being with aging are discussed in Charles and Carstensen, “Social and Emotional Aging.”
3. 排序
3. SORTING
“Nowe if the word”: Cawdrey 的《字母表》 (A Table Alphabeticall)是第一本英语单语词典。有关排序与搜索的历史,请参阅 Knuth 的《计算机编程艺术》(The Art of Computer Programming)第 6.2.1 节。有关字母顺序的发明,请参阅 Daly 的《字母表历史贡献》(Contributions to a History of Alphabetization)。
“Nowe if the word”: Cawdrey, A Table Alphabeticall, is the first monolingual dictionary of English. For more on the history of sorting vis-à-vis searching, see Knuth, The Art of Computer Programming, §6.2.1. For more on the invention of alphabetical order, see Daly, Contributions to a History of Alphabetization.
室友拿出一只袜子:希利斯的《石头上的图案》。
The roommate pulled a sock out: Hillis, The Pattern on the Stone.
发布到编程网站 Stack Overflow: “如何高效地从一堆袜子中挑出一对袜子?” 由用户“amit”于 2013 年 1 月 19 日提交到 Stack Overflow,http://stackoverflow.com/questions/14415881/pair-socks-from-a-pile-efficiently。
posted to the programming website Stack Overflow: “Pair socks from a pile efficiently?” Submitted by user “amit” to Stack Overflow on January 19, 2013, http://stackoverflow.com/questions/14415881/pair-socks-from-a-pile-efficiently.
正如“amit”(真名 Amit Gross,以色列理工学院研究生)所写:“昨天,我正在从干净的衣物中挑选袜子配对,然后发现我的方法效率不高。我做了一个简单的搜索——挑出一只袜子,然后‘迭代’这堆袜子以找到与之匹配的那双。这平均需要迭代n / 2 × n / 4 = n 2 / 8 双袜子。作为一名计算机科学家,我在思考我能做些什么?”
As “amit” (real name Amit Gross, a graduate student at the Technion) writes: “Yesterday I was pairing the socks from the clean laundry, and figured out the way I was doing it is not very efficient. I was doing a naive search—picking one sock and ‘iterating’ the pile in order to find its pair. This requires iterating over n/2 × n/4 = n2/8 socks on average. As a computer scientist I was thinking what I could do?”
阿米特的问题引来了许多答案,但最受其他程序员支持的答案是进行基数排序:确定袜子变化的维度(例如颜色、图案),并根据每个维度将它们分成几堆。每次排序只需遍历所有袜子一次,最终会得到一组更小的堆。即使你必须遍历所有袜子才能找到匹配的袜子,所需的时间也与最大堆大小的平方成正比,而不是与袜子总数的平方成正比。(更多关于基数排序的内容,请参阅下文关于对一副牌进行排序的尾注。)
Amit’s question generated a number of answers, but the one that received the most support from his fellow programmers was to do a Radix Sort: identify the dimensions along which the socks vary (e.g., color, pattern) and sort them into piles on each of these dimensions. Each sort requires only one pass through all the socks, and the result is a set of smaller piles. Even if you have to go through all the socks in those piles to find matches, the amount of time this takes is proportional to the square of the size of the largest pile rather than the square of the total number of socks. (See the endnote below about sorting a deck of cards for more on Radix Sort.)
但是,如果我们配对袜子的原因是为了在需要时更容易找到一双袜子,那么我们可以通过采用更好的搜索程序来减少分类的需要。
But if the reason we are pairing socks is to make it easier to find a pair of socks when we need them, we can reduce the need for sorting by adopting a better procedure for searching.
假设你的袜子只有一个颜色不同,而你的袜子抽屉里有三双不同颜色的宽松袜子。那么,如果你随机从抽屉里拿出四只袜子,就一定能找到一双匹配的。(要理解原因,想象一下最坏的情况:前三只袜子的颜色各不相同。当你再拿出第四只袜子时,它必须与之前拿出的三只袜子中的一只颜色匹配。)无论你有多少种颜色,只要比袜子颜色多拿出一只,就能保证找到一双匹配的袜子。所以,如果你愿意让你的晨跑速度慢一点,就不用费心去配对袜子了。
Let’s say your socks differ along only one dimension—color—and you have three different colors of loose, unpaired socks in your sock drawer. Then you are guaranteed to find a matching pair if you take four socks out of the drawer at random. (To see why, imagine the worst-case scenario: each of the first three socks that have been pulled out are a different color. When you go back for a fourth, it has to match one of the three you have pulled out already.) No matter how many colors you have, taking out one more sock than the number of colors always guarantees you a matching pair. So don’t bother pairing them if you’re willing to have your morning run a little slower.
这个巧妙的袜子配对问题解决方案源自鸽巢原理。鸽巢原理是一个简单却强大的数学概念,由十九世纪德国数学家彼得·古斯塔夫·勒热纳·狄利克雷 (Peter Gustave Lejeune Dirichlet) 提出。(Rittaud 和 Heeffer 合著的《鸽巢原理》追溯了鸽巢原理的历史,包括狄利克雷以及更早的文献。) 鸽巢原理很简单:如果一群鸽子落入一组鸽巢洞中,鸽子数量多于洞数,则至少有一个洞中一定有多只鸽子。在计算机科学中,鸽巢原理用于确立算法理论性质的基本事实。例如,不可能设计出一种算法,能够在不丢失信息的情况下压缩任何文件,因为长文件的数量远多于短文件的数量。
This neat solution to the problem of pairing socks comes courtesy of the Pigeonhole Principle, a simple but powerful mathematical idea attributed to the nineteenth-century German mathematician Peter Gustave Lejeune Dirichlet. (Rittaud and Heeffer, “The Pigeonhole Principle,” traces the history of the Pigeonhole Principle, including Dirichlet as well as what appear to be even earlier references.) The idea is simple: if a group of pigeons lands in a set of nesting holes, and there are more pigeons than holes, then at least one hole must contain more than one pigeon. In computer science, the Pigeonhole Principle is used to establish basic facts about the theoretical properties of algorithms. For example, it is impossible to make an algorithm that will compress any possible file without loss of information, because there are more long files than there are short files.
运用鸽巢原理,可以永久解决袜子配对问题:只买一种袜子。如果你所有的袜子都一样,你就永远不需要配对,因为你总能从抽屉里拿出两只袜子配成一双。对许多计算机科学家(包括一些回答阿米特问题的程序员)来说,这是最优雅的方法——重新定义问题,使其能够高效地解决。
Applying the Pigeonhole Principle suggests a permanent solution to the problem of sock pairing: only buy one kind of sock. If all your socks are the same, you never need to pair them, because you can always get a pair by taking two socks out of the drawer. For many computer scientists (including some of the programmers who responded to Amit’s question) this is the most elegant approach—redefining the problem so it can be solved efficiently.
不过,最后提醒一句:买那种袜子的时候,一定要小心选择合适的袜子。罗恩·里维斯特之所以对袜子特别挑剔,是因为他左右脚穿的袜子不一样。这违背了鸽巢原理——为了保证袜子的匹配性,你需要拿出比袜子总数多一只的袜子。
One last word of warning, though: when you buy that one kind of sock, be careful what kind of socks you buy. The reason why Ron Rivest has particular problems with socks is that he wears socks that are different for left and right feet. This thwarts the Pigeonhole Principle—to guarantee a match with socks like that, you’ll need to pull out one more sock than the total number of pairs.
“袜子让我困惑!”:罗纳德·里维斯特,个人访谈,2013 年 7 月 25 日。
“Socks confound me!”: Ronald Rivest, personal interview, July 25, 2013.
“变得盲目和疯狂”:马丁,《用电力统计一个国家》。
“go blind and crazy”: Martin, “Counting a Nation by Electricity.”
“如神的磨坊般精准无误”:同上。
“unerringly as the mills of the Gods”: Ibid.
“除了政府,没有人会使用它”:奥地利人赫尔曼·霍勒里斯 (Herman Hollerith)引用。
“no one will ever use it but governments”: Quoted in Austrian, Herman Hollerith.
霍勒瑞斯 (Hollerith) 的公司与其他几家公司合并:奥地利人赫尔曼·霍勒瑞斯 (Herman Hollerith)。
Hollerith’s firm merged with several others: Austrian, Herman Hollerith.
为“存储程序”计算机编写的第一个代码:这里的“书写”指的是手写:当著名数学家约翰·冯·诺依曼于1945年草草写下排序程序时,该程序所针对的计算机距离完成还有几年时间。虽然计算机程序的起源可以追溯到1843年艾达·洛夫莱斯为查尔斯·巴贝奇提出的“分析机”所编写的程序,但冯·诺依曼的程序是第一个被设计存储在计算机内存中的程序;早期的计算机是通过插入的穿孔卡片或连接线进行特定计算的。参见Knuth的《冯·诺依曼的第一个计算机程序》。
first code ever written for a “stored program” computer: “Written,” here, means literally written out by hand: when the renowned mathematician John von Neumann jotted down the sorting program in 1945, the computer it was meant for was still several years away from completion. Although computer programs in general date back to Ada Lovelace’s writing in 1843 on the proposed “Analytical Engine” of Charles Babbage, von Neumann’s program was the first one designed to be stored in the memory of the computer itself; earlier computing machines were meant to be guided by punch cards fed into them, or wired for specific calculations. See Knuth, “Von Neumann’s First Computer Program.”
超越IBM的专用卡片分类机:同上。
outsort IBM’s dedicated card-sorting machines: Ibid.
世界上四分之一的计算资源: Knuth,《计算机编程艺术》,第 3 页。
a quarter of the computing resources of the world: Knuth, The Art of Computer Programming, p. 3.
“分拣的单位成本不但没有下降,反而上升了”: Hosken,《分拣方法评估》。
“unit cost of sorting, instead of falling, rises”: Hosken, “Evaluation of Sorting Methods.”
整理一副牌的记录:虽然我们找不到 Bradáč 表演的视频,但网上有很多人试图打破记录的视频。他们倾向于将牌分成四种花色,然后对每种花色中的数字进行排序。“但有一种更快的方法可以做到这一点!”Donald Knuth 在《计算机编程艺术》中敦促道:首先,根据牌的面值将牌分成 13 堆(一堆全是 2,一堆全是 3,等等)。然后,收集好所有牌堆后,将牌分成四种花色。结果每种花色都有一堆,每种花色中的牌都按顺序排列。这是一种基数排序,与我们在本章后面讨论的桶排序算法有关。请参阅 Knuth,《计算机编程艺术》,§5.2.5。
the record for sorting a deck of cards: While we couldn’t find a video of Bradáč’s performance, there are plenty of videos online of people trying to beat it. They tend to sort cards into the four suits, and then sort the numbers within each suit. “But there is a faster way to do the trick!” urges Donald Knuth in The Art of Computer Programming: First, deal out the cards into 13 piles based on their face value (with one pile containing all the 2s, the next all the 3s, etc.). Then, after gathering up all the piles, deal the cards out into the four suits. The result will be one pile for each suit, with the cards ordered within each. This is a Radix Sort, and is related to the Bucket Sort algorithm we discuss later in the chapter. See Knuth, The Art of Computer Programming, §5.2.5.
完全靠机会排序:通过随机化对事物进行排序并希望获得最佳结果实际上是一种名为Bogosort 的算法,它属于计算机科学中唯一半开玩笑的子领域“最差算法设计”。悲观主义与最优性的关系就像悲观主义与乐观主义的关系一样;最差算法设计者们相互竞争,以超越彼此,从而获得最差的计算性能。
completely sorted by chance: Sorting things by randomizing them and hoping for the best is actually an algorithm with a name: Bogosort, part of computer science’s only partly tongue-in-cheek subfield of “pessimal algorithm design.” Pessimality is to optimality what pessimism is to optimism; pessimal algorithm designers compete to outdo each other for the worst possible computing performance.
进一步研究这个问题,悲观算法设计者得出结论,Bogosort 实际上过于精简和高效。因此他们提出了“改进” Bogobogosort,该方法首先逐步对前两个元素进行 Bogosort 排序,然后是前三个,依此类推。如果在任何时候列表乱序,Bogobogosort 就会重新开始。因此,例如,该算法要完成四张牌的排序,就必须先将前两张牌抛向空中,看到它们落地正确,然后是前三张牌抛向空中,看到它们落地正确,最后是前四张牌抛向空中,也看到它们落地正确,并且顺序正确。全部排成一行。否则就重新开始。第一个撰写有关 Bogobogosort 文章的工程师之一报告说,他在电脑上运行该算法一夜,却无法对包含七项的列表进行排序,最后他出于怜悯关掉了电源。
Looking into the matter further, pessimal algorithm designers have concluded that Bogosort is actually far too lean and efficient. Hence their “improvement” Bogobogosort, which starts by incrementally Bogosorting the first two elements, then the first three, and so forth. If at any point in time the list gets out of order, Bogobogosort starts over. So the algorithm won’t complete a sort of four cards, for instance, until it throws the first two up in the air, sees that they’ve landed correctly, then throws the first three in the air, sees that they’ve landed correctly, and at last throws the first four in the air and finds them in the correct order too. All in a row. Otherwise it starts over. One of the engineers to first write about Bogobogosort reports running it on his computer overnight and being unable to sort a list of seven items, before he finally turned off the electricity out of mercy.
后来的工程师们认为,Bogobogosort 甚至还不是井底之蛙,他们甚至提议获取更多元数据,并对程序而不是数据进行 Bogosorting:随机翻转计算机内存中的比特位,直到它恰好变成一个可以对项目进行排序的排序程序。这种庞然大物的时间界限仍在探索中。对悲观性的追求仍在继续。
Subsequent engineers have suggested that Bogobogosort isn’t even the bottom of the well, and have proposed getting even more meta and Bogosorting the program rather than the data: randomly flipping bits in the computer memory until it just so happens to take the form of a sorting program that sorts the items. The time bounds of such a monstrosity are still being explored. The quest for pessimality continues.
计算机科学已经发展出一种简写:大 O 符号起源于 Paul Bachmann于 1894 年出版的《分析理论》 。另请参阅 Donald Knuth, 《计算机编程艺术》,§1.2.11.1。正式地说,如果算法的运行时间小于或等于f ( n ) 的倍数(系数为正常数),我们说它的运行时间为O ( f ( n ))。还有类似的“大 Omega”符号,其中Ω ( f ( n )) 表示运行时间大于或等于f ( n )的倍数,以及“大 Theta”符号,其中Θ ( f ( n )) 表示运行时间既是O ( f ( n )) 又是Ω ( f ( n ))。
Computer science has developed a shorthand: Big-O notation originated in the 1894 book Die analytische zahlentheorie by Paul Bachmann. See also Donald Knuth, The Art of Computer Programming, §1.2.11.1. Formally, we say that the runtime of an algorithm is O(f(n)) if it is less than or equal to a multiple (with a coefficient that is a positive constant) of f(n). There is also the kindred “Big-Omega” notation, with Ω(f(n)) indicating that the runtime is greater than or equal to a multiple of f(n), and “Big-Theta” notation, with Θ(f(n)) meaning the runtime is both O(f(n)) and Ω(f(n)).
“他让我掌握了冒泡排序法”:这位工程师就是 Dan Siroker,我们在第二章中见过他。例如,请参阅《连线》杂志2012 年 5 月刊的“A/B 测试:改变商业规则的技术内幕” 。
“He had me at Bubble Sort”: This engineer is Dan Siroker, whom we met earlier in chapter 2. See, e.g., “The A/B Test: Inside the Technology That’s Changing the Rules of Business,” Wired, May 2012.
信息处理始于美国人口普查:有关更多详细信息,请参阅 Knuth 的《计算机编程艺术》,§5.5。
information processing began in the US censuses: For more details, see Knuth, The Art of Computer Programming, §5.5.
展示存储程序计算机的威力:这台计算机就是EDVAC机器,当时冯·诺依曼的程序被列为绝密军事情报。参见Knuth,《冯·诺依曼的第一个计算机程序》。
to demonstrate the power of the stored-program computer: The computer was the EDVAC machine, and at the time von Neumann’s program was classified as top-secret military intelligence. See Knuth, “Von Neumann’s First Computer Program.”
“归并排序在排序史上同样重要”: Katajainen 和 Träff,《对归并排序程序的细致分析》。
“Mergesort is as important in the history of sorting”: Katajainen and Träff, “A Meticulous Analysis of Mergesort Programs.”
大规模工业排序问题:目前的排序记录托管于http://sortbenchmark.org/。截至 2014 年,三星的一个团队保持着一分钟内排序数据量最大的记录——高达 3.7TB。这相当于近 370 亿张扑克牌,足以装满 500 架波音 747 飞机,这让我们得以一窥兹德涅克·布拉达奇 (Zdeněk Bradáč) 创造的人类扑克牌排序记录。
large-scale industrial sorting problems: The current records for sorting are hosted at http://sortbenchmark.org/. As of 2014, a group from Samsung holds the record for sorting the most data in a minute—a whopping 3.7 terabytes of data. That’s the equivalent of almost 37 billion playing cards, enough to fill five hundred Boeing 747s to capacity, putting Zdeněk Bradáč’s human record for sorting cards in perspective.
每分钟167本书:运输经理托尼·米兰达说:“我们每小时最多能处理250个托特包。平均每小时大约处理180个托特包。记住,每个托特包里大概有40多本书。” 摘自“KCLS AMH Tour”,2007年11月6日,https://www.youtube.com/watch?v =4fq3CWsyde4 。
167 books a minute: Says shipping manager Tony Miranda, “We will process—I think our highest is—250 totes in one hour. Our average is about 180 totes in one hour. Keep in mind, each tote has about 40-plus items inside of it.” From “KCLS AMH Tour,” November 6, 2007, https://www.youtube.com/watch?v=4fq3CWsyde4.
每天 85,000 份: “降低运营成本”,《美国图书馆杂志》,2010 年 8 月 31 日,http://www.americanlibrariesmagazine.org/aldirect/al-direct-september-1-2010。
85,000 a day: “Reducing operating costs,” American Libraries Magazine, August 31, 2010, http://www.americanlibrariesmagazine.org/aldirect/al-direct-september-1-2010.
“Fuhgeddaboutit”:参见 Matthew Taub 的“布鲁克林和曼哈顿在第四届年度‘图书分类员大战’中击败华盛顿州” , 《布鲁克林简报》 ,2014 年 10 月 29 日,http://brooklynbrief.com/4th-annual-battle-book-sorters-pits-brooklyn-washington-state/。
“Fuhgeddaboutit”: See Matthew Taub, “Brooklyn & Manhattan Beat Washington State in 4th Annual ‘Battle of the Book Sorters,’” Brooklyn Brief, October 29, 2014, http://brooklynbrief.com/4th-annual-battle-book-sorters-pits-brooklyn-washington-state/.
我们所能希望实现的最好结果:一组n项可以有恰好n!种不同的排序,因此排序恰好产生 log n!位信息,大约为n log n位。回想一下,n!是n × ( n − 1) × … × 2 × 1,它是n个数的乘积,其中n是最大值。因此,n!< n n,所以 log n!< log n n,这给我们 log n!< n log n 。这种n log n对 log n !的近似值称为“斯特林近似值”,以十八世纪苏格兰数学家詹姆斯斯特林的名字命名。因为一次成对比较最多会产生一位信息,所以需要n log n 次比较才能完全解决我们对n 个事物的n!种可能排序中哪个是正确的排序的不确定性。有关更多详细信息,请参阅 Knuth 的《计算机编程艺术》,§5.3.1。
the best we can hope to achieve: A set of n items can have precisely n! distinct orderings, so a sort produces exactly log n! bits of information, which is approximately n log n bits. Recall that n! is n × (n − 1) × … × 2 × 1, which is the product of n numbers, of which n is the largest. Consequently, n! < nn, so log n! < log nn, which then gives us log n! < n log n. This approximation of n log n for log n! is called “Stirling’s approximation,” named for eighteenth-century Scottish mathematician James Stirling. Because a single pairwise comparison yields at most one bit of information, n log n comparisons are needed to fully resolve our uncertainty about which of the n! possible orders of our n things is the right one. For more detail, see Knuth, The Art of Computer Programming, §5.3.1.
“我从经验中知道”:乔丹·何,个人采访,2013 年 10 月 15 日。
“I know from experience”: Jordan Ho, personal interview, October 15, 2013.
有关“电子邮件超载”的论文: Whittaker 和 Sidner,“电子邮件超载”。
a paper on “email overload”: Whittaker and Sidner, “Email Overload.”
“有点浪费了生命的一部分”:史蒂夫·惠特克,个人采访,2013 年 11 月 14 日。
“sort of wasted a part of their life”: Steve Whittaker, personal interview, November 14, 2013.
“在草地网球锦标赛上”:道奇森,《草地网球锦标赛》。
“At a Lawn Tennis Tournament”: Dodgson, “Lawn Tennis Tournaments.”
对三重淘汰制的尴尬看法:有关 Dodgson 锦标赛提案的计算机科学批评,请参阅 Donald Knuth 在《计算机编程艺术》第 5.3.3 节中对“最小比较选择”的讨论。
an awkward take on triple elimination: For a computer-scientific critique of Dodgson’s tournament proposal, see Donald Knuth’s discussion of “minimum-comparison selection” in The Art of Computer Programming, §5.3.3.
不能产生完整的排序:一种算法,不是对所有项目进行排名,而是将其中一个项目确定为最大、第二大或中位数等,这种算法被称为“选择”算法,而不是排序算法。
doesn’t produce a full ordering: An algorithm that, rather than ranking all of the items, identifies one of them as the largest or second-largest or median, etc., is known as a “selection” algorithm, rather than a sorting algorithm.
美国职业棒球大联盟的赛程安排员:特里克是体育赛程安排小组的成员,该小组是他共同创立的。从1981年到2004年,美国职业棒球大联盟的赛程安排由杰出的夫妻档亨利·斯蒂芬森和霍莉·斯蒂芬森亲手制定。ESPN在约瑟夫·加纳执导的短片《赛程安排员》中记录了斯蒂芬森夫妇的故事。
schedulers for Major League Baseball: Trick works as part of the Sports Scheduling Group, which he co-founded. From 1981 to 2004, the schedule for Major League Baseball was constructed by hand, by the remarkable husband-and-wife team of Henry and Holly Stephenson. ESPN chronicled the story of the Stephensons in a short film directed by Joseph Garner titled The Schedule Makers.
“不确定性的解决被推迟了”:迈克尔·特里克,个人访谈,2013 年 11 月 26 日。
“uncertainty is delayed in its resolution”: Michael Trick, personal interview, November 26, 2013.
“实际上无论他们是谁”:同上。
“practically no matter who they are”: Ibid.
“3:2 的比分意味着获胜”:汤姆·墨菲,《关注噪音?》(Tuning in on Noise?),2014 年 6 月 22 日发表于“做数学”博客:http://physics.ucsd.edu/do-the-math/2014/06/tuning-in-on-noise/
“A 3:2 score gives the winning team”: Tom Murphy, “Tuning in on Noise?” Published June 22, 2014 on the “Do the Math” blog: http://physics.ucsd.edu/do-the-math/2014/06/tuning-in-on-noise/
认识到算法稳健性的优点: Ackley,“超越效率”。
recognizing the virtues of robustness in algorithms: Ackley, “Beyond Efficiency.”
“冒泡排序没有明显的优点”: Knuth,《计算机编程艺术》,§5.5。
“bubble sort has no apparent redeeming features”: Knuth, The Art of Computer Programming, §5.5.
该奖项的获得者:戴夫·阿克利(Dave Ackley),个人访谈,2013年11月26日。请参阅Jones和Ackley的《排序算法中的比较关键性》以及Ackley的《超越效率》。有关比较计数排序(有时也称为循环排序)的更多信息,请参阅Knuth的《计算机编程艺术》,§5.2。
The winner of that particular honor: Dave Ackley, personal interview, November 26, 2013. See Jones and Ackley, “Comparison Criticality in Sorting Algorithms,” and Ackley, “Beyond Efficiency.” For more about Comparison Counting Sort (also sometimes known as Round-Robin Sort) see Knuth, The Art of Computer Programming, §5.2.
“作为一名职业扑克玩家最重要的技能”:艾萨克·哈克斯顿,个人访谈,2014 年 2 月 20 日。
“most important skill as a professional poker player”: Isaac Haxton, personal interview, February 20, 2014.
“想象两只猴子”:克里斯托夫·诺伊曼,个人访谈,2014 年 1 月 29 日。
“Imagine two monkeys”: Christof Neumann, personal interview, January 29, 2014.
“每只母鸡的攻击性行为增加”:克雷格,《鸡的攻击性行为》。
“aggressive acts per hen increased”: Craig, Aggressive Behavior of Chickens.
计算负担沉重: Jessica Flack,个人访谈,2014年9月10日。另请参阅DeDeo、Krakauer和Flack的《集体冲突动态中的战略周期性证据》;Daniels、Krakauer和Flack的《灵长类社会中的冲突稀疏编码》;Brush、Krakauer和Flack的《从网络数据计算节点状态共识的算法家族》。有关Flack研究的更广泛概述,请参阅Flack的《生命的信息层级》。
There’s a significant computational burden: Jessica Flack, personal interview, September 10, 2014. See also DeDeo, Krakauer, and Flack, “Evidence of Strategic Periodicities in Collective Conflict Dynamics”; Daniels, Krakauer, and Flack, “Sparse Code of Conflict in a Primate Society”; Brush, Krakauer, and Flack, “A Family of Algorithms for Computing Consensus About Node State from Network Data.” For a broader overview of Flack’s work, see Flack, “Life’s Information Hierarchy.”
这项体育竞赛就是马拉松:马拉松在排序算法的世界里也有类似之处。排序理论中一个更耐人寻味的进展(在这篇文章被彻底删除之前,维基百科用“深奥”这个词来形容它)来自一个最意想不到的地方:臭名昭著的互联网留言板 4chan。2011 年初,那里出现了一篇匿名帖子:“伙计,我真是个天才。看看我刚发明的排序算法。” 帖子中的“排序算法”——睡眠排序——为每个未排序项创建一个处理线程,让每个线程“睡眠”其值的秒数,然后“唤醒”并输出自身。最终的输出确实应该是排序好的。撇开揭示睡眠排序逻辑漏洞的实现细节不谈,仅从表面来看,它似乎确实承诺了一些令人陶醉的东西:一种运行时间完全不取决于元素数量,而是取决于元素大小的排序。 (因此,它仍然不如直接的O(1)恒定时间排序那么好。)
This sporting contest is the marathon: The marathon has an analogue in the world of sorting algorithms. One of the more intriguing (Wikipedia used the word “esoteric” before the article was removed entirely) developments in beyond-comparison sorting theory arose from one of the most unlikely places: the notorious Internet message board 4chan. In early 2011, an anonymous post there proclaimed: “Man, am I a genius. Check out this sorting algorithm I just invented.” The poster’s “sorting algorithm”—Sleep Sort—creates a processing thread for each unsorted item, telling each thread to “sleep” the number of seconds of its value, and then “wake up” and output itself. The final output should, indeed, be sorted. Leaving aside the implementation details that reveal the cracks in Sleep Sort’s logic and just taking Sleep Sort on face value, it does seem to promise something rather intoxicating: a sort whose runtime doesn’t depend on the number of elements at all, but rather on their size. (Thus it’s still not quite as good as a straight-up O(1) constant-time sort.)
“你去赚钱”:这是英国企业家亚历山大·迪恩 (Alexander Dean) 在https://news.ycombinator.com/item?id=8871524上表达的。
“You go to the money”: This is articulated by British entrepreneur Alexander Dean at https://news.ycombinator.com/item?id=8871524.
“体型较大者为王”:总吨位法则似乎确实主宰着海洋。这并不是说鱼类完全爱好和平。值得注意的是,当体型相近时,它们会激烈地争斗。
“the bigger one is the dominant one”: The Law of Gross Tonnage, it seems, really does rule the ocean. This is not to say fish are entirely pacifistic. It’s worth noting that they will fight—aggressively—when their sizes are similar.
4.缓存
4. CACHING
“在我们智力的实际运用中”:詹姆斯,《心理学》。
“In the practical use of our intellect”: James, Psychology.
现在您面临两个问题:这种结构源于一个著名的编程笑话,该笑话由 Netscape 工程师 Jamie Zawinski 于 1997 年 8 月 12 日在 Usenet 帖子中首次提出:“有些人遇到问题时会想‘我知道,我会使用正则表达式。’现在他们面临两个问题。”
Now you have two problems: This construction nods to a famous programming joke first coined by Netscape engineer Jamie Zawinski in a Usenet post on August 12, 1997: “Some people, when confronted with a problem, think ‘I know, I’ll use regular expressions.’ Now they have two problems.”
“我拥有它多久了?”:斯图尔特,《玛莎·斯图尔特的家政手册》。
“How long have I had it?”: Stewart, Martha Stewart’s Homekeeping Handbook.
“把所有的裙子挂在一起”:杰伊,《少即是多》
“Hang all your skirts together”: Jay, The Joy of Less.
“物品将按类型分类”:梅伦,整理你的生活!
“Items will be sorted by type”: Mellen, Unstuff Your Life!
“意识非常敏锐,但几乎没有记忆”:戴维斯,《几乎没有记忆》。
“a very sharp consciousness but almost no memory”: Davis, Almost No Memory.
计算的基本原理之一:我们的缓存历史基于 Hennessy 和 Patterson 提供的《计算机体系结构》 ,该书对计算机设计中的现代缓存方法也有很好的论述。
one of the fundamental principles of computing: Our history of caching is based on that provided by Hennessy and Patterson, Computer Architecture, which also has a great treatment of modern caching methods in computer design.
电“记忆器官”:伯克斯、戈德斯坦和冯·诺依曼,《电子计算仪器逻辑设计的初步讨论》。
an electrical “memory organ”: Burks, Goldstine, and von Neumann, Preliminary Discussion of the Logical Design of an Electronic Computing Instrument.
位于英国曼彻斯特的一台名为 Atlas 的超级计算机: Kilburn 等人的“单级存储系统”。
a supercomputer in Manchester, England, called Atlas: Kilburn et al., “One-Level Storage System.”
“自动积累单词”:威尔克斯,《从属记忆和动态存储分配》。
“automatically accumulates to itself words”: Wilkes, “Slave Memories and Dynamic Storage Allocation.”
在 IBM 360/85 超级计算机中实现: Conti、Gibson 和 Pitkowsky,“System/360 Model 85 的结构方面”。
implemented in the IBM 360/85 supercomputer: Conti, Gibson, and Pitkowsky, “Structural Aspects of the System/360 Model 85.”
CPU 中的晶体管数量每两年翻一番:摩尔在 1965 年《在集成电路中塞入更多元件》一文中最初预测的是每年翻一番;1975 年,他在《数字集成电子学的进展》中将这一预测修改为每两年翻一番。
number of transistors in CPUs would double every two years: Moore’s initial 1965 prediction in “Cramming More Components onto Integrated Circuits” was for a doubling every year; in 1975 he then revised this in “Progress in Digital Integrated Electronics” to be a doubling every two years.
六层内存层次结构:寄存器;L1、L2 和 L3 缓存;RAM;以及磁盘。有关“内存墙”的更多信息,请参阅 Wulf 和 McKee 的《打破内存墙》。
six-layer memory hierarchy: Registers; L1, L2, and L3 caches; RAM; and disk. For more on the “memory wall,” see, for instance, Wulf and McKee, “Hitting the Memory Wall.”
“不要让无用的事实挤掉有用的事实”:柯南·道尔,《血字的研究:约翰·H·华生的回忆录》。
“not to have useless facts elbowing out the useful ones”: Conan Doyle, “A Study in Scarlet: The Reminiscences of John H. Watson.”
“单词无法无限期地保存在其中”:威尔克斯,《从属内存和动态存储分配》。
“words cannot be preserved in it indefinitely”: Wilkes, “Slave Memories and Dynamic Storage Allocation.”
贝拉迪于1928年出生于匈牙利:贝拉迪的个人经历基于他2002年与菲利普·L·弗拉纳(Philip L. Frana)进行的口述历史访谈(可访问https://conservancy.umn.edu/bitstream/107110/1/oh352lab.pdf)。他对缓存算法的分析及其结果发表于贝拉迪的《虚拟存储计算机替换算法研究》(A Study of Replacement Algorithms for a Virtual-Storage Computer)。
Bélády was born in 1928 in Hungary: Bélády’s personal history is based on an oral history interview he conducted with Philip L. Frana in 2002 (available at https://conservancy.umn.edu/bitstream/107110/1/oh352lab.pdf). His analysis of caching algorithms and results are presented in Bélády, “A Study of Replacement Algorithms for a Virtual-Storage Computer.”
十五年来被引用次数最多的计算机科学研究成果:贝拉迪本人曾说:“我 1965 年撰写的论文成为 15 年来软件领域被引用次数最多的论文。” JAN Lee,“Laszlo A. Belady”,载于《计算机先驱》,http://history.computer.org/pioneers/belady.html。
the most cited piece of computer science research for fifteen years: From Bélády himself: “My paper written in 1965 became the Citation Index most-referenced paper in the field of software over a 15-year period.” J. A. N. Lee, “Laszlo A. Belady,” in Computer Pioneers, http://history.computer.org/pioneers/belady.html.
LRU 的表现始终接近于千里眼:几年后,Bélády 又证明了 FIFO 还有一些奇怪的缺点——尤其是在极少数情况下,增加缓存大小反而会降低性能,这种现象被称为 Bélády 异常。Bélády、Nelson 和 Shedler,《在分页机中运行的某些程序的时空特征异常》。
LRU consistently performed the closest to clairvoyance: A couple of years later, Bélády also showed that FIFO has some curious additional drawbacks—in particular, rare cases where increasing the cache size can actually worsen performance, a phenomenon known as Bélády’s Anomaly. Bélády, Nelson, and Shedler, “An Anomaly in Space-Time Characteristics of Certain Programs Running in a Paging Machine.”
“数字化相当于洗牌文件”: Aza Raskin,《解决 Alt-Tab 问题》,http://www.azarask.in/blog/post/solving-the-alt-tab-problem/。
“the digital equivalent of shuffling papers”: Aza Raskin, “Solving the Alt-Tab Problem,” http://www.azarask.in/blog/post/solving-the-alt-tab-problem/.
关于驱逐策略的文献:如果您有兴趣尝试更复杂的缓存算法,LRU 的一些流行变体如下:
The literature on eviction policies: If you’re interested in trying a more complex caching algorithm, some popular variants on LRU are the following:
• LRU- K:O'Neil、O'Neil 和 Weikum 合著的《数据库磁盘缓冲的 LRU- K页面替换算法》,该算法关注自最近第K次使用以来所经过的时间(对于缓存中未使用K次的项目,该时间最长)。这引入了频率偏差。LRU-2 算法最常见,它关注倒数第二次使用。
• LRU-K: O’Neil, O’Neil, and Weikum, “The LRU-K Page Replacement Algorithm for Database Disk Buffering,” which looks at the time elapsed since the K-th most recent use (which is maximal for items in the cache that have not been used K times). This introduces a frequency bias. LRU-2, which focuses on the penultimate use, is most common.
• 2Q:Johnson 和 Shasha 的“2Q:一种低开销高性能缓冲区管理替换算法”,该算法将项目组织到两个独立的“队列”中,以捕获少量频率信息。项目最初位于第一个队列中,如果它们在缓存中再次被引用,则会提升到第二个队列。使用 LRU 算法将项目从第二个队列中驱逐回第一个队列,该算法也用于从第一个队列中驱逐项目。
• 2Q: Johnson and Shasha, “2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm,” which organizes items into two separate “queues” to capture a little bit of frequency information. Items start in the first queue, and are promoted to the second queue if they are referred to again while they are in the cache. Items are evicted from this second queue back into the first queue using LRU, which is also used to evict items from the first queue.
• LRFU:Lee 等人的“LRFU:包含最近最少使用和最不常用策略的策略范围”,它结合了新近度和频率,为每个项目分配一个数值分数,当项目被使用时,该分数会增加,但随着时间的推移逐渐减少。
• LRFU: Lee et al., “LRFU: A Spectrum of Policies That Subsumes the Least Recently Used and Least Frequently Used Policies,” which combines recency and frequency by assigning a numerical score to each item that is incremented when the item is used but decreases gradually over time.
• 自适应替换缓存 (ARC):Megiddo 和 Modha,“使用自适应替换缓存算法超越 LRU”,它以类似于 2Q 的方式使用两个队列,但根据性能调整队列的长度。
• The Adaptive Replacement Cache (ARC): Megiddo and Modha, “Outperforming LRU with an Adaptive Replacement Cache Algorithm,” which uses two queues in a similar fashion to 2Q but adapts the length of the queues based on performance.
事实证明,所有这些算法在缓存管理性能测试中都优于 LRU。
All of these algorithms have been shown to outperform LRU in tests of cache-management performance.
计算机科学家的最爱:例如,Pavel Panchekha 在 2012 年为 Dropbox 博客撰写了一篇文章,其中阐述了 Dropbox 使用 LRU 的理由,网址为https://tech.dropbox.com/2012/10/caching-in-theory-and-practice/。
overwhelming favorite of computer scientists: For instance, Pavel Panchekha wrote an article in 2012 for the Dropbox blog where he lays out Dropbox’s reasoning for using LRU, at https://tech.dropbox.com/2012/10/caching-in-theory-and-practice/.
在地下 Gardner Stacks 深处:对于那些好奇我们参观时加州大学伯克利分校的学生到底在读什么的人:梭罗的《瓦尔登湖》;关于《自我之歌》、科马克·麦卡锡、詹姆斯·梅里尔、托马斯·品钦、伊丽莎白·毕晓普、JD 塞林格、阿奈斯·宁和苏珊·桑塔格的评论文本;朱诺特·迪亚兹的《溺水》;迈克尔·夏邦的《电报大道》和《意第绪警察联盟》;安妮·普鲁的《肮脏的泥土》和《鸟云》 ;马克·斯特兰德的《宝贝夫妇》 ;菲利普·迪克的《高堡奇人》;威廉·卡洛斯·威廉姆斯的诗集和散文;查克·帕拉尼克的《鼻烟》;托妮·莫里森的《秀拉》 ;丹尼斯·约翰逊的《烟树》 ;朱莉安娜·斯帕尔的《每个人与肺的联系》;乔里·格雷厄姆的《统一场之梦》大卫·塞达里斯的《裸体》、《有一天我会好好说话》和《给你的家人穿上灯芯绒和牛仔布衣服》;西尔维娅·普拉斯的《爱丽儿》和大卫·马梅特的《奥利安娜》 ;DT Max 的大卫·福斯特·华莱士传记;CD 赖特的《像倒飞的东西》、《福音书翻译成方言》和《深步闪耀》;TS 艾略特的散文;埃德加·爱伦·坡的《尤里卡》 ;赫尔曼·梅尔维尔的《比利巴德,水手》和一部诗歌和散文短篇作品集;亨利·詹姆斯的《阿斯彭遗稿》、 《一位淑女的画像》和《螺丝在拧紧》 ;哈罗德·布鲁姆评比利巴德、贝尼托·塞雷诺和“抄写员巴特比”;尤金·奥尼尔的戏剧;尼尔·盖曼的《星尘》 ;谢尔曼·阿莱克西的《保留地蓝调》;科马克·麦卡锡的《老无所依》等等。
Deep within the underground Gardner Stacks: For those curious to know exactly what UC Berkeley students had been reading when we visited: Thoreau’s Walden; critical texts on Song of Myself, Cormac McCarthy, James Merrill, Thomas Pynchon, Elizabeth Bishop, J. D. Salinger, Anaïs Nin, and Susan Sontag; Drown by Junot Díaz; Telegraph Avenue and The Yiddish Policemen’s Union by Michael Chabon; Bad Dirt and Bird Cloud by Annie Proulx; Mr. and Mrs. Baby by Mark Strand; The Man in the High Castle by Philip K. Dick; the collected poetry and prose of William Carlos Williams; Snuff by Chuck Palahniuk; Sula by Toni Morrison; Tree of Smoke by Denis Johnson; The Connection of Everyone with Lungs by Juliana Spahr; The Dream of the Unified Field by Jorie Graham; Naked, Me Talk Pretty One Day, and Dress Your Family in Corduroy and Denim by David Sedaris; Ariel by Sylvia Plath and Oleanna by David Mamet; D. T. Max’s biography of David Foster Wallace; Like Something Flying Backwards, Translations of the Gospel Back into Tongues, and Deepstep Come Shining by C. D. Wright; the prose of T. S. Eliot; Eureka by Edgar Allan Poe; Billy Budd, Sailor and a collection of short works in poetry and prose by Herman Melville; The Aspern Papers, The Portrait of a Lady, and The Turn of the Screw by Henry James; Harold Bloom on Billy Budd, Benito Cereno, and “Bartleby the Scrivener”; the plays of Eugene O’Neill; Stardust by Neil Gaiman; Reservation Blues by Sherman Alexie; No Country for Old Men by Cormac McCarthy; and more.
“十二年,这就是分界线”:伊丽莎白·杜普伊,个人访谈,2014 年 9 月 16 日。
“twelve years, that’s the cutoff”: Elizabeth Dupuis, personal interview, September 16, 2014.
“以一英里到一英里的尺度衡量!”卡罗尔、西尔维和布鲁诺总结道。
“on the scale of a mile to the mile!”: Carroll, Sylvie and Bruno Concluded.
四分之一的互联网流量: Stephen Ludin,《Akamai:为何四分之一的互联网比其他互联网更快更安全》,讲座,2014年3月19日,国际计算机科学研究所,加州伯克利。Akamai在其网站上声称:“Akamai贡献了所有网络流量的15%至30%”(http://www.akamai.com/html/about/facts_figures.html)。
A quarter of all Internet traffic: Stephen Ludin, “Akamai: Why a Quarter of the Internet Is Faster and More Secure than the Rest,” lecture, March 19, 2014, International Computer Science Institute, Berkeley, California. As Akamai claims on their own site, “Akamai delivers between 15–30% of all Web traffic” (http://www.akamai.com/html/about/facts_figures.html).
“距离很重要”: Ludin,“Akamai。”
“distance matters”: Ludin, “Akamai.”
避开任何类型的人类可理解的组织:亚马逊的“混乱存储”系统在此处描述:http://www.ssi-schaefer.de/blog/en/order-picking/chaotic-storage-amazon/。
eschew any type of human-comprehensible organization: Amazon’s “chaotic storage” system is described here: http://www.ssi-schaefer.de/blog/en/order-picking/chaotic-storage-amazon/.
亚马逊获得一项专利:这项关于预先运送常见请求物品的专利是美国专利号 8,615,473,于 2013 年 12 月 24 日授予,名为“预期包裹运送方法和系统”,由 Joel R. Spiegel、Michael T. McKenna、Girish S. Lakshman 和 Paul G. Nordstrom 代表亚马逊技术公司提出。
Amazon was granted a patent: The patent on preshipping commonly requested items is US Patent No. 8,615,473, granted December 24, 2013, “Method and system for anticipatory package shipping” by Joel R. Spiegel, Michael T. McKenna, Girish S. Lakshman, and Paul G. Nordstrom, on behalf of Amazon Technologies Inc.
媒体抓住了这些内容:例如,参见 Connor Simpson 的“亚马逊会在您有购买意愿之前就将商品卖给您”,The Wire,2014 年 1 月 20 日,http://www.thewire.com/technology/2014/01/amazon-thinks-it-can-predict-your-future/357188 /;Chris Matyszczyk 的“亚马逊会在您有购买意愿之前就将商品发货?”,CNET,2014 年 1 月 19 日,http://www.cnet.com/news/amazon-to-ship-things-before-youve-even-thought-of-buying-them/。
which the press seized upon: See, e.g., Connor Simpson, “Amazon Will Sell You Things Before You Know You Want to Buy Them,” The Wire, January 20, 2014, http://www.thewire.com/technology/2014/01/amazon-thinks-it-can-predict-your-future/357188/; Chris Matyszczyk, “Amazon to Ship Things Before You’ve Even Thought of Buying Them?,” CNET, January 19, 2014, http://www.cnet.com/news/amazon-to-ship-things-before-youve-even-thought-of-buying-them/.
Netflix 上每个州的“本地最爱”: Micah Mertes,“美国的 Netflix 本地最爱”,2011 年 7 月 10 日,http://www.slacktory.com/2011/07/united-states-netflix-local-favorites/。
each state’s “Local Favorites” from Netflix: Micah Mertes, “The United States of Netflix Local Favorites,” July 10, 2011, http://www.slacktory.com/2011/07/united-states-netflix-local-favorites/.
构成完整高清视频的海量文件: 2012年,Netflix宣布厌倦了向Akamai等公司付费,并开始构建自己的全球CDN。请参阅Eric Savitz的《Netflix将流量转移到自己的CDN》,《福布斯》 ,2012年6月5日,http://www.forbes.com/sites/ericsavitz/2012/06/05/netflix-shifts-traffic-to-its-own-cdn-akamai-limelight-shrs-hit/。更多关于Netflix Open Connect CDN的信息,请访问https://www.netflix.com/openconnect。
the enormous files that comprise full-length HD video: In 2012, Netflix announced that it was tired of paying firms like Akamai and had started building its own global CDN. See Eric Savitz, “Netflix Shifts Traffic to Its Own CDN,” Forbes, June 5, 2012, http://www.forbes.com/sites/ericsavitz/2012/06/05/netflix-shifts-traffic-to-its-own-cdn-akamai-limelight-shrs-hit/. More information about Netflix’s Open Connect CDN can be found at https://www.netflix.com/openconnect.
“缓存是一件显而易见的事情”:约翰·轩尼诗,个人访谈,2013 年 1 月 9 日。
“Caching is such an obvious thing”: John Hennessy, personal interview, January 9, 2013.
“我家前衣帽间地板上的一个板条箱”:摩根斯坦 (Morgenstern),《从内到外的整理》。
“a crate on the floor of my front coat closet”: Morgenstern, Organizing from the Inside Out.
“沙发后面有额外的吸尘器袋”:琼斯,《保留找到的东西》。
“extra vacuum cleaner bags behind the couch”: Jones, Keeping Found Things Found.
从认知角度看搜索引擎:参见 Belew 的《Finding Out About》。
search engines from a cognitive perspective: See Belew, Finding Out About.
建议使用衣架: Rik Belew,个人采访,2013 年 10 月 31 日。
recommended the use of a valet stand: Rik Belew, personal interview, October 31, 2013.
“我的方法中的一个非常基本的原则”:野口幸雄,个人访谈,2013 年 12 月 17 日。
“a very fundamental principle in my method”: Yukio Noguchi, personal interview, December 17, 2013.
“超级”归档系统诞生:野口勇的归档系统在他的著作《超级组织方法》(Super Organized Method)中有所描述,最初由译者威廉·利斯(William Lise)以英文发表。描述该系统的博客文章已在利斯的网站上消失,但仍可通过互联网档案馆(https://web.archive.org/web/20031223072329/http://www.lise.jp/honyaku/noguchi.html )访问。更多信息来自野口勇于2013年12月17日的个人访谈。
the “super” filing system was born: Noguchi’s filing system is described in his book Super Organized Method, and was initially presented in English by the translator William Lise. The blog article describing the system is no longer available on Lise’s site, but it can still be visited via the Internet Archive at https://web.archive.org/web/20031223072329/http://www.lise.jp/honyaku/noguchi.html. Further information comes from Yukio Noguchi, personal interview, December 17, 2013.
关于自组织列表的权威论文: Sleator 和 Tarjan 的“列表更新和分页规则的摊销效率”,该论文也对 LRU 原则的理论性质提供了最清晰的结果。
The definitive paper on self-organizing lists: Sleator and Tarjan, “Amortized Efficiency of List Update and Paging Rules,” which also provided the clearest results on the theoretical properties of the LRU principle.
“如果你愿意的话,可以称之为上帝的算法”:罗伯特·塔尔扬,个人访谈,2013 年 12 月 17 日。
“God’s algorithm if you will”: Robert Tarjan, personal interview, December 17, 2013.
如果遵循 LRU 原则:将 LRU 原则应用于自组织列表称为Move-to-Front算法。
if you follow the LRU principle: This application of the LRU principle to self-organizing lists is known as the Move-to-Front algorithm.
不仅仅是高效,它实际上是最优的:这并不意味着你必须完全放弃分类。如果你想让搜索更美观、加快搜索速度,野口勇建议给不同类别的文件添加彩色标签。这样,如果你知道自己要查找的是账户,就可以将线性搜索限制在这些项目上。而且,它们仍然会根据每个类别中的“移至最前”规则进行排序。
not merely efficient. It’s actually optimal: This doesn’t mean you must entirely give up on categorization. If you want to make things a bit more gaudy and speed up the search process, Noguchi suggests putting colored tabs on files that fall into different categories. That way if you know you’re looking for, say, accounts, you can restrict your linear search to just those items. And they will still be sorted according to the Move-to-Front Rule within each category.
大学图书馆的信息检索系统:安德森关于人类记忆的研究成果发表在安德森和米尔森合著的《人类记忆》以及《思维的适应性特征》一书中。这本书因其提出的分析日常认知的理想方案策略而具有深远的影响,汤姆和其他许多人在其研究中也运用了该策略。安德森和米尔森合著的《人类记忆》则借鉴了巴雷尔合著的《图书馆借阅的简单随机模型》中关于图书馆借阅的统计研究成果。
the information retrieval systems of university libraries: Anderson’s findings on human memory are published in Anderson and Milson, “Human Memory,” and in the book The Adaptive Character of Thought. This book has been influential for laying out a strategy for analyzing everyday cognition in terms of ideal solutions, used by Tom and many others in their research. Anderson and Milson, “Human Memory,” in turn, draws from a statistical study of library borrowing that appears in Burrell, “A Simple Stochastic Model for Library Loans.”
心智研究中缺失的一块:安德森最初探索计算机信息检索与人类记忆组织之间的联系,是在大多数人从未接触过信息检索系统,当时使用的系统也相当原始的时代进行的。随着搜索引擎研究不断拓展信息检索系统的边界,它为探索心智与机器之间的相似之处创造了新的机遇。例如,汤姆和他的同事已经展示了谷歌 PageRank 算法背后的理念如何与理解人类语义记忆息息相关。参见格里菲斯、斯蒂弗斯和菲尔合著的《谷歌与心智》。
the missing piece in the study of the mind: Anderson’s initial exploration of connections between information retrieval by computers and the organization of human memory was conducted in an era when most people had never interacted with an information retrieval system, and the systems in use were quite primitive. As search engine research has pushed the boundaries of what information retrieval systems can do, it’s created new opportunities for discovering parallels between minds and machines. For example, Tom and his colleagues have shown how ideas behind Google’s PageRank algorithm are relevant to understanding human semantic memory. See Griffiths, Steyvers, and Firl, “Google and the Mind.”
“我看到那个框架展现在我面前”:安德森,《思维的适应性特征》。
“I saw that framework laid out before me”: Anderson, The Adaptive Character of Thought.
分析了三种人类环境:安德森和斯库勒在《记忆中的环境反射》中提出了对人类记忆环境的分析。
analyzed three human environments: The analysis of the environment of human memory is presented in Anderson and Schooler, “Reflections of the Environment in Memory.”
现实本身具有统计结构: “人类记忆以惊人的保真度反映了环境中存在的结构。”同上。
reality itself has a statistical structure: “Human memory mirrors, with a remarkable degree of fidelity, the structure that exists in the environment.” Ibid.
“未能理解人类记忆之前的任务”:同上。
“fail to appreciate the task before human memory”: Ibid.
“大书令人厌烦”:这句话的希腊语引文是“ μ έ γ α βιβλίον μέγα κακόν ”(mega biblion, mega kakon),也被翻译为“大书,大恶魔”。原文意在贬低史诗,但作为一名身处书籍都是数十英尺长卷轴时代的学者,大书除了美观之外,在很多方面都令人厌烦。这就是为什么直到书籍以带有页码的抄本形式出现后,人们才开始正式引用和引文的原因。有关这段历史的精彩叙述,请参阅布尔斯廷的《发现者》。
“A big book is a big nuisance”: The quotation in Greek is “μέγα βιβλίον μέγα κακόν” (mega biblion, mega kakon), which has also been translated as “Big book, big evil.” The original reference is intended as a disparagement of epic poetry, but presumably being a scholar at a time when books were in the form of scrolls dozens of feet long meant that big books were a nuisance in more ways than aesthetic. There’s a reason why the practice of citation and quotation didn’t properly begin until books came in codices with numbered pages. For an excellent recounting of this history, see Boorstin, The Discoverers.
“如果你让一座城市变得更大”:约翰·轩尼诗,个人访谈,2014 年 1 月 9 日。
“If you make a city bigger”: John Hennessy, personal interview, January 9, 2014.
信息量不可避免的后果: Ramscar 等人,“认知衰退的神话”。
an unavoidable consequence of the amount of information: Ramscar et al., “The Myth of Cognitive Decline.”
“心智是天然的信息处理设备:”迈克尔·拉姆斯卡(Michael Ramscar),“提供商独家:迈克尔·拉姆斯卡谈认知能力下降的‘神话’”,接受比尔·迈尔斯(Bill Myers)采访,2014 年 2 月 19 日。http: //www.providermagazine.com/news/Pages/0214/Provider-Exclusive-Michael-Ramscar-On-The-Myth-Of-Cognitive-Decline.aspx。
“minds are natural information processing devices:” Michael Ramscar, “Provider Exclusive: Michael Ramscar on the ‘Myth’ of Cognitive Decline,” interview with Bill Myers, February 19, 2014. http://www.providermagazine.com/news/Pages/0214/Provider-Exclusive-Michael-Ramscar-On-The-Myth-Of-Cognitive-Decline.aspx.
5. 日程安排
5. SCHEDULING
“我们如何度过我们的日子”:迪拉德,《写作生活》。
“How we spend our days”: Dillard, The Writing Life.
“写书就像发动战争”:劳勒,《古老的故事》。
“Book-writing, like war-making”: Lawler, “Old Stories.”
“我们重复的行为决定了我们自身”:这句话常被认为是亚里士多德本人所言,但实际上它源自学者威尔·杜兰特,是杜兰特对亚里士多德思想的总结。参见杜兰特,《哲学的故事》。
“We are what we repeatedly do”: In fact, this phrase, frequently attributed to Aristotle himself, originated with scholar Will Durant, as a summary (in Durant’s words) of Aristotle’s thinking. See Durant, The Story of Philosophy.
任何两分钟或更短时间的任务:艾伦,《把事情做完》。
any task of two minutes or less: Allen, Getting Things Done.
从最难的任务开始:特蕾西,吃掉那只青蛙!这本书将书名引言——“早上第一件事就是吃掉一只活青蛙,那么接下来的一天就不会再发生更糟糕的事情了”——归咎于马克·吐温,尽管这种说法可能是伪造的。“名言调查员”网站引用了18世纪法国作家尼古拉·尚福尔作为更可能的出处。更多信息,请访问http://quoteinvestigator.com/2013/04/03/eat-frog/ 。
beginning with the most difficult task: Tracy, Eat That Frog! The book ascribes its titular quotation—“Eat a live frog first thing in the morning and nothing worse will happen to you the rest of the day”—to Mark Twain, although this attribution may be apocryphal. The Quote Investigator website cites eighteenth-century French writer Nicolas Chamfort as the more likely source. See http://quoteinvestigator.com/2013/04/03/eat-frog/ for more.
首先安排自己的社交活动: Fiore,《现在的习惯》。
first scheduling one’s social engagements: Fiore, The Now Habit.
“永远悬而未决的未完成任务”:威廉·詹姆斯在 1886 年 1 月 1 日写给卡尔·斯坦普夫的一封信中写道。
“the eternal hanging on of an uncompleted task”: William James, in a letter to Carl Stumpf, January 1, 1886.
故意 不 立即做事: Partnoy,等待。
deliberately not doing things right away: Partnoy, Wait.
开发了甘特图:泰勒和甘特在排程史上所扮演的角色,赫尔曼在《泰勒、甘特和约翰逊的观点》一书中进行了总结。更多关于泰勒的传记细节,请参阅卡尼格尔在《最佳方法》一书中所作的介绍。
developed the Gantt charts: The role of Taylor and Gantt in the history of scheduling is summarized in Herrmann, “The Perspectives of Taylor, Gantt, and Johnson.” Additional biographical details on Taylor are from Kanigel, The One Best Way.
亚马逊、宜家和 SpaceX 等公司:甘特图软件公司 LiquidPlanner 在(违反直觉的)URL http://www.liquidplanner.com/death-to-gantt-charts/上宣称亚马逊、宜家和 SpaceX 都是其客户。
firms like Amazon, IKEA, and SpaceX: Gantt chart software company LiquidPlanner boasts Amazon, IKEA, and SpaceX among its clients at the (counterintuitive) URL http://www.liquidplanner.com/death-to-gantt-charts/.
第一个暗示表明这个问题甚至 可以 得到解决:约翰逊的开创性成果(关于现在所谓的“流水车间”调度,其中作业从一台机器流向另一台机器)出现在“包含设置时间的最佳两阶段和三阶段生产计划”中。
first hint that this problem even could be solved: Johnson’s seminal result (on what is now called “flowshop” scheduling, where jobs flow from one machine to another) appears in “Optimal Two- and Three-Stage Production Schedules with Setup Times Included.”
从最早截止的任务开始:最早截止日 (EDD),也称为杰克逊规则,源自杰克逊的《调度生产线以最小化最大迟到率》。詹姆斯·R·杰克逊于 20 世纪 30 年代在洛杉矶长大,通过参与加州大学洛杉矶分校的物流研究项目,他花时间参观了该地区各航空公司经营的机械车间。他对作业如何从一台机器转移到另一台机器的思考最终促使他开发了一种用于分析“网络流”的数学方法——这项工作后来被用于设计用于路由互联网流量的算法。生产与运营管理学会刊登了詹姆斯·R·杰克逊的简短传记。
start with the task due soonest: Earliest Due Date (EDD), also known as Jackson’s Rule, was derived in Jackson, Scheduling a Production Line to Minimize Maximum Tardiness. James R. Jackson grew up in Los Angeles in the 1930s, and through his work with UCLA’s Logistics Research Project spent time visiting machine shops run by various aerospace companies in the area. His thinking about how jobs moved from one machine to another ultimately led him to develop a mathematics for analyzing “network flows”—work that would later be used in the design of algorithms for routing the flow of traffic on the Internet. A brief biography appears in Production and Operations Management Society, “James R. Jackson.”
Moore 算法: Moore 在其论文《一种最小化延迟作业数量的N作业单机排序算法》中提出。在论文中,Moore 承认了 Thom J. Hodgson 向他提出的一种简化和优化方法。如今,“Moore 算法”、“Hodgson 算法”和“Moore-Hodgson 算法”这些术语有时可以互换使用。
Moore’s Algorithm: Presented in Moore, “An N Job, One Machine Sequencing Algorithm for Minimizing the Number of Late Jobs.” In the paper, Moore acknowledged a simplification and optimization that had been suggested to him by Thom J. Hodgson. Today the terms “Moore’s Algorithm,” “Hodgson’s Algorithm,” and the “Moore–Hodgson Algorithm” are sometimes used interchangeably.
尽可能快地完成任务:最短处理时间 (SPT) 或史密斯规则被证明可以最小化史密斯在“单阶段生产的各种优化器”中的完成时间总和。
do the quickest task you can: Shortest Processing Time (SPT), or Smith’s Rule, was shown to minimize the sum of completion times in Smith, “Various Optimizers for Single-Stage Production.”
出现在动物觅食研究中: Stephens 和 Krebs,觅食理论。
shows up in studies of animal foraging: Stephens and Krebs, Foraging Theory.
又称“滚雪球策略”:在大众视野中,作家兼演说家戴夫·拉姆齐或许是“滚雪球策略”最著名的推广者和倡导者,他既赢得了众多支持者,也赢得了众多批评者。在学术界,例如,西北大学商学院研究人员盖尔和麦克沙恩2012年发表的论文《小胜利能帮助赢得战争吗?》(Can Small Victories Help Win the War?),以及德克萨斯农工大学布朗和莱希经济学家2014年发表的论文《小胜利》( Small Victories),都探讨了“小胜利”在帮助人们摆脱消费债务方面的影响。
known as the “debt snowball”: In the popular sphere, author and speaker Dave Ramsey is perhaps the best-known popularizer and advocate of the “debt snowball” strategy, and has garnered many supporters and detractors alike. On the academic side, a 2012 paper by business school researchers at Northwestern, Gal and McShane, “Can Small Victories Help Win the War?” and a 2014 paper by economists at Texas A&M Brown and Lahey, Small Victories, for instance, have looked at the impact of “small victories” in helping people get out of consumer debt.
强迫症吸血鬼:这一集是第 5 季第 12 集“Bad Blood”,最初于 1998 年 2 月 22 日播出。
an obsessive-compulsive vampire: This episode is Season 5, Episode 12, “Bad Blood,” which originally aired February 22, 1998.
“预先拖延的倾向”: Rosenbaum、Gong 和 Potts,《预先拖延》。
“a tendency to pre-crastinate”: Rosenbaum, Gong, and Potts, “Pre-Crastination.”
里夫斯将该错误归咎于“截止日期压力”:这来自格伦·里夫斯于 1997 年 12 月 15 日发给同事的一封电子邮件,主题为“火星上到底发生了什么?”,可在线访问http://research.microsoft.com/en-us/um/people/mbj/Mars_Pathfinder/Authoritative_Account.html。
Reeves would blame the bug on “deadline pressures”: This comes from an email dated December 15, 1997, from Glenn Reeves to his colleagues, subject line “What really happened on Mars?,” available online at http://research.microsoft.com/en-us/um/people/mbj/Mars_Pathfinder/Authoritative_Account.html.
“如果你易燃并且有腿”:赫德伯格的故事可以在他 1999 年的喜剧专辑《Strategic Grill Locations》中找到。
“If you’re flammable and have legs”: Hedberg’s tale can be found on his 1999 comedy album Strategic Grill Locations.
“最重要的事情”:这句引语在英语中第一次出现似乎是在柯维的《如何成功与人相处》一书中,其中没有引用就归于歌德。
“Things which matter most”: The first appearance of this quotation in English seems to be in Covey, How to Succeed with People, where it’s attributed to Goethe without citation.
“这就是我每天完成工作的方式”:劳拉·阿尔伯特·麦克莱,个人访谈,2014 年 9 月 16 日。
“That’s how I get things done every day”: Laura Albert McLay, personal interview, September 16, 2014.
“吉恩正在推迟某事”: Jan Karel Lenstra,个人采访,2014 年 9 月 2 日;以及私人信件。
“Gene was postponing something”: Jan Karel Lenstra, personal interview, September 2, 2014; and personal correspondence.
劳勒走了一条有趣的迂回路线:劳勒的传记取材于劳勒的《老故事》和伦斯特拉的《二元性的神秘力量》。
Lawler took an intriguingly circuitous route: Lawler’s biography is drawn from Lawler, “Old Stories,” and Lenstra, “The Mystical Power of Twoness.”
计算机科学系的“社会良知”:Richard Karp,《伯克利计算机科学的个人观点》,加州大学伯克利分校电子工程与计算机科学系,http://www.eecs.berkeley.edu/BEARS/CS_Anniversary/karp-talk.html。
“the social conscience” of the computer science department: Richard Karp, “A Personal View of Computer Science at Berkeley,” EECS Department, University of California, Berkeley, http://www.eecs.berkeley.edu/BEARS/CS_Anniversary/karp-talk.html.
以劳勒的名义颁发的奖项:请参阅http://awards.acm.org/lawler/。
an award in Lawler’s name: See http://awards.acm.org/lawler/.
从后往前构建时间表: Lawler 对最大延迟问题的优先约束的分析载于 Lawler 的“受优先约束的单台机器的最佳排序”一文中。
build the schedule back to front: Lawler’s analysis of precedence constraints for the maximum lateness problem is in Lawler, “Optimal Sequencing of a Single Machine Subject to Precedence Constraints.”
这就是该领域所说的“棘手”问题:这项分析来自 Lawler 的《按优先顺序排列作业以最小化总加权完成时间》。更准确地说,这个问题是“ NP难”,这意味着它没有已知的有效解决方案,并且可能永远不会有。
it’s what the field calls “intractable”: This analysis is in Lawler, “Sequencing Jobs to Minimize Total Weighted Completion Time Subject to Precedence Constraints.” More precisely, the problem is “NP-hard,” meaning it has no known efficient solution, and might never have one.
绘制整个调度理论图景的探索:这个探索诞生于 1975 年的一个下午,当时 Lawler、Lenstra 和他们的同事 Richard Karp 和 Ben Lageweg 坐在阿姆斯特丹的数学中心讨论调度理论。也许是隔壁阿姆斯特尔啤酒厂飘来的“刺鼻的麦芽和啤酒花气味”,这个团队受到某种启发,决定出版一本列出所有调度问题及其是否已解决的书籍,作为送给他们的朋友兼同事 Alexander Rinnooy Kan 的一份精美礼物,当时他即将进行论文答辩。(这个故事出现在 Lawler 的“老故事”和 Lenstra 的“二重性的神秘力量”中。)Rinnooy Kan 不仅对学术界,而且对荷兰经济都做出了重要贡献,他是 ING 的董事会成员,并连续三年被《人民报》评为荷兰最具影响力的人物。参见“Rinnooy Kan weer invloedrijkste Nederlander”,De Volkskrant,2009 年 12 月 4 日,http://nos.nl/artikel/112743-rinnooy-kan-weer-invloedrijkste-nederlander.html。
a quest to map the entire landscape of scheduling theory: The quest emerged one afternoon in 1975, as Lawler, Lenstra, and their colleagues Richard Karp and Ben Lageweg sat around talking scheduling theory in the Mathematisch Centrum in Amsterdam. Perhaps it was the “pungent odors of malt and hops” in the air from the Amstel brewery next door, but something inspired the group to decide that a book containing a list of all scheduling problems and whether they had been solved would make a nice gift for their friend and colleague Alexander Rinnooy Kan, who was about to defend his thesis. (This story appears in Lawler, “Old Stories,” and Lenstra, “The Mystical Power of Twoness.”) Rinnooy Kan would go on to make important contributions not just to academia but also to the Dutch economy, sitting on the board of directors at ING and being named by the newspaper De Volkskrant as the most influential person in the Netherlands—three years in a row. See “Rinnooy Kan weer invloedrijkste Nederlander,” De Volkskrant, December 4, 2009, http://nos.nl/artikel/112743-rinnooy-kan-weer-invloedrijkste-nederlander.html.
拉格维格编写了一个计算机程序来生成这份清单,列举了调度问题的大约4536种不同排列组合:所有可能的指标组合(最大延迟时间、延迟作业数量、完成时间总和等)和约束条件(权重、优先级、开始时间等)。在一系列令人着迷的日子里,这个团队“欣喜地快速地解决了一个又一个晦涩难懂的问题类型”。
Lageweg wrote a computer program that generated the list, enumerating some 4,536 different permutations of the scheduling problem: every possible combination of metrics (maximum lateness, number of late jobs, sum of completion times, etc.) and constraints (weights, precedence, start times, and so on) that they could think of. Over a series of enthralling days, the group “had the pleasure of knocking off one obscure problem type after another in rapid succession.”
他们用来描述复杂调度问题的组织架构是一种“带有简写”的语言,他们称之为“调度语”(Graham 等人,《确定性排序中的优化与近似》)。其基本思想是,调度问题由三个变量描述:所涉及机器的性质、作业的性质以及调度目标。这三个变量按此顺序指定,并使用标准代码描述优先约束、抢占、释放时间和目标等因素。例如,1| r j | ∑ C j(发音为“one-arejay-sum-ceejay”)表示单台机器、释放时间和最小化完成时间总和的目标。正如 Eugene Lawler 所述:
Their organizational schema for describing the zoo of scheduling problems was a language “laced with shorthand,” which they called “Schedulese” (Graham et al., “Optimization and Approximation in Deterministic Sequencing”). The basic idea is that scheduling problems are described by three variables: the nature of the machines involved, the nature of the jobs, and the goal of scheduling. These three variables are specified in that order, with standard codes describing factors such as precedence constraints, preemption, release times, and the goal. For example, 1|rj|∑Cj (pronounced “one-arejay-sum-ceejay”) represents a single machine, release times, and the goal of minimizing the sum of completion times. As Eugene Lawler recounts:
我们立竿见影的成果是我们能够非常轻松地沟通问题类型。来我们办公室的访客有时会困惑地听到这样的对话:“既然one-arejay-sum-ceejay是NP难,这是否意味着one- preemption -arejay-sum-ceejay也是NP难?” “不,这很容易,记得吗?” “嗯,one-deejay-sum-ceejay很容易,这意味着one- preemption -deejay-sum-ceejay也很容易,那么我们对one-preemption-arejay-deejay-sum-ceejay了解多少呢?” “什么都不知道。”
An immediate payoff was the consummate ease with which we could communicate problem types. Visitors to our offices were sometimes baffled to hear exchanges such as: “Since one-arejay-sum-ceejay is NP-hard, does that imply that one-preemption-arejay-sum-ceejay is NP-hard, too?” “No, that’s easy, remember?” “Well, one-deejay-sum-ceejay is easy and that implies one-preemption-deejay-sum-ceejay is easy, so what do we know about one-preemption-arejay-deejay-sum-ceejay?” “Nothing.”
(正式表示为:“由于 1| r j | ∑ C j是 NP 难的,这是否意味着 1| pmtn, r j | ∑ C j也是 NP 难的?”“不,这很容易,记得吗?”“嗯,1| d j | ∑ C j很容易,这意味着 1| pmtn, d j | ∑ C j也很容易,那么我们对 1| pmtn, r j , d j | ∑ C j了解多少呢?”“什么都不知道”[Lawler 等人,“给亚历山大的礼物!”;另见 Lawler,“老故事”]。)
(In formal notation: “Since 1|rj|∑ Cj is NP-hard, does that imply that 1|pmtn, rj|∑ Cj is NP-hard, too?” “No, that’s easy, remember?” “Well, 1|dj|∑ Cj is easy and that implies 1|pmtn, dj|∑ Cj is easy, so what do we know about 1|pmtn, rj, dj|∑ Cj?” “Nothing” [Lawler et al., “A Gift for Alexander!”; see also Lawler, “Old Stories”].)
问题变得难以解决:事实上,它相当于“背包问题”,即计算机科学中最著名的关于如何填充空间的棘手问题。该调度问题与背包问题的联系出现在 Lawler 的《单机调度以最小化延迟作业数量》一书中。
the problem becomes intractable: In fact, it’s equivalent to the “knapsack problem,” computer science’s most famously intractable problem about how to fill space. The connection between this scheduling problem and the knapsack problem appears in Lawler, Scheduling a Single Machine to Minimize the Number of Late Jobs.
设定一个特定的时间开始执行某些任务:我们所说的“开始时间”在文献中(我们认为有点模棱两可)被称为“发布时间”。Lenstra、Rinnooy Kan 和 Brucker 在《机器调度问题的复杂性》一文中指出,最小化完成时间总和和最小化任意发布时间的最大延迟都是NP难问题。Lawler 在《调度单台机器以最小化延迟作业数量》一文中讨论了最小化任意发布时间的延迟作业数量的情况。
a certain time to start some of your tasks: What we are calling “start times” are referred to in the literature (we think somewhat ambiguously) as “release times.” Lenstra, Rinnooy Kan, and Brucker, “Complexity of Machine Scheduling Problems,” showed that both minimizing sum of completion times and minimizing maximal lateness with arbitrary release times are NP-hard. The case of minimizing the number of late jobs with arbitrary release times is discussed in Lawler, “Scheduling a Single Machine to Minimize the Number of Late Jobs.”
最近的一项调查: Lawler 等人的《排序和调度》。此列表的最新版本可在http://www.informatik.uni-osnabrueck.de/knust/class/上找到。
A recent survey: Lawler et al., “Sequencing and Scheduling.” The most recent version of this list is available at http://www.informatik.uni-osnabrueck.de/knust/class/.
经过相当直接的修改: Baker 等人在《单机抢占式调度》中分析了抢占对于最小化具有释放时间的最大延迟的影响。Schrage 在《最短剩余处理时间原则的最优性证明》和 Baker 的《排序和调度简介》中分析了最小化具有释放时间和抢占的完成时间总和的问题。
with a fairly straightforward modification: The effect of preemption on minimizing maximal lateness with release times is analyzed in Baker et al., “Preemptive Scheduling of a Single Machine.” The problem of minimizing the sum of completion times with release times and preemption is analyzed in Schrage, “A Proof of the Optimality of the Shortest Remaining Processing Time Discipline” and Baker, Introduction to Sequencing and Scheduling.
仍然是最早到期日的抢占版本:通过选择最早到期日的作业来最小化预期最大延迟的结果在 Pinedo、Scheduling中进行了讨论。
still the preemptive version of Earliest Due Date: The result for minimizing expected maximum lateness by choosing the job with earliest due date is discussed in Pinedo, Scheduling.
最短处理时间的抢占式版本:Sevcik 在“使用服务时间分布进行最小总损失调度”中展示了选择具有加权最短预期处理时间的作业对于最小化动态设置中的加权完成时间总和的有效性(假设完成作业的时间估计值在该作业的工作持续时间内不增加),这是动态调度的更一般策略的一部分。
the preemptive version of Shortest Processing Time: The effectiveness of choosing the job with the weighted shortest expected processing time for minimizing the sum of weighted completion times in a dynamic setting (provided the estimate of the time to complete a job is nonincreasing in the duration worked on that job) was shown by Sevcik, “Scheduling for Minimum Total Loss Using Service Time Distributions,” as part of a more general strategy for dynamic scheduling.
这些作业的加权延迟总和: Pinedo 的《带有发布日期和到期日期的随机调度》表明,在作业时间服从无记忆分布(相当强的)假设下,该算法对于此类问题而言是最优的,这意味着无论作业执行了多长时间,你对作业所需时间的估计都保持不变。在随机调度中,最优算法并不一定适用于所有可能的工作负载,而是最小化其相关指标的预期值。
sum of the weighted lateness of those jobs: Pinedo, “Stochastic Scheduling with Release Dates and Due Dates,” showed that this algorithm is optimal for these problems under the (fairly strong) assumption that the times of jobs follow a memoryless distribution, which means that your estimate of how long they will take remains constant no matter how long you have been doing them. In stochastic scheduling, optimal algorithms won’t necessarily be ideal for every possible workload, but rather minimize the expected values of their relevant metrics.
“用‘猜测’代替‘计划’”: Jason Fried,“我们就把计划称为猜测吧”,2009 年 7 月 14 日,https://signalvnoise.com/posts/1805-lets-just-call-plans-what-they-are-guesses。
“Replace ‘plan’ with ‘guess’”: Jason Fried, “Let’s just call plans what they are: guesses,” July 14, 2009, https://signalvnoise.com/posts/1805-lets-just-call-plans-what-they-are-guesses.
“你不能下火车”:乌尔曼,《过时了》。
“You must not get off the train”: Ullman, “Out of Time.”
可能包括延迟和错误: Monsell,“任务切换”。
can include both delays and errors: Monsell, “Task Switching.”
“我还是去跑腿吧”:柯克·普鲁斯,个人访谈,2014 年 9 月 4 日。
“I’ll just do errands instead”: Kirk Pruhs, personal interview, September 4, 2014.
“你吸引了我一部分注意力”: 《社交网络》,剧本由艾伦·索尔金创作;哥伦比亚电影公司,2010 年。
“You have part of my attention”: The Social Network, screenplay by Aaron Sorkin; Columbia Pictures, 2010.
“没人知道这件事”:彼得·丹宁,个人采访,2014 年 4 月 22 日。
“Nobody knew anything about that”: Peter Denning, personal interview, April 22, 2014.
“导致服务彻底崩溃”: Denning,《Thrashing:其原因与预防》。
“caused a complete collapse of service”: Denning, “Thrashing: Its Causes and Prevention.”
“对于当前的工作负载来说,缓存已经热起来了”: Peter Zijlstra,个人采访,2014 年 4 月 17 日。
“The caches are warm for the current workload”: Peter Zijlstra, personal interview, April 17, 2014.
任何系统陷入瘫痪的情况:系统抖动也可能发生在数据库系统中。在这种情况下,不同进程之间争夺数据库访问“锁”,可能会超出系统允许当前持有锁的进程执行任何操作的能力。同样,系统抖动也可能出现在网络环境中。在这种情况下,各种信号争夺网络通道,可能会阻止任何进程通过。我们将在第 10 章中详细讨论后一种情况。
any situation where the system grinds to a halt: Thrashing can also take place in database systems, where the competition between different processes to acquire “locks” to access the database can swamp the system’s ability to let the processes currently holding the locks get anything done. Similarly, thrashing can appear in networking contexts, where a cacophony of different signals competing for the network channel can prevent anything at all from getting through. We’ll take a closer look at the latter scenario in chapter 10.
更换了调度程序: Linux 从 2001 年的 2.4 版本开始使用的“ O ( n ) 调度程序”会按优先级对所有进程进行排序,进程越多,执行时间就越长。从 2003 年的 Linux 2.6 版本开始, O (n) 调度程序被废弃,取而代之的是“ O(1) 调度程序”。无论进程数量多少,O(1) 调度程序都会按桶排序,将所有进程放入预定数量的桶中。然而,执行这种桶排序需要计算复杂的启发式算法,因此从 2007 年的 Linux 2.6.23 版本开始,“ O (1) 调度程序”被更直接的“完全公平调度程序”所取代。
replaced their scheduler: The “O(n) Scheduler” used by Linux starting with version 2.4 in 2001 sorted all processes by priority, which took longer the more processes there were. This was scrapped in favor of the “O(1) Scheduler” starting with Linux 2.6 in 2003, which bucket-sorted all processes into a predetermined number of buckets, regardless of how many processes there were. However, doing this bucket sort required computing complex heuristics, and beginning with Linux 2.6.23 in 2007, the “O(1) Scheduler” was replaced with the even more straightforward “Completely Fair Scheduler.”
在 Linux 中这个最小有用切片:这个值在 Linux 内核的“完全公平调度程序”的变量 sysctl_sched_min_granularity 中定义。
In Linux this minimum useful slice: This value is defined in the Linux kernel’s “Completely Fair Scheduler” in the variable sysctl_sched_min_granularity.
诸如“时间盒”或“番茄工作法”之类的方法:时间盒在软件开发团队管理领域被广泛提及;“时间盒”一词似乎起源于 Zahniser 的著作《实现最佳团队绩效的时间盒》。“番茄工作法”的名称源于一个番茄形状的厨房计时器(意大利语中“番茄”的意思是pomodoro),由 Francesco Cirillo 于 20 世纪 80 年代末发明,并从 1998 年开始教授。例如,请参阅 Cirillo 的《番茄工作法》。
Methods such as “timeboxing” or “pomodoros”: Timeboxing has been written about widely in the context of the management of software development teams; the term “timeboxing” appears to originate with Zahniser, “Timeboxing for Top Team Performance.” The “Pomodoro Technique,” whose name comes from a tomato-shaped kitchen timer (the Italian word for tomato being pomodoro), was devised by Francesco Cirillo in the late 1980s and has been taught by Cirillo starting in 1998. See, e.g., Cirillo, The Pomodoro Technique.
程序员已经转向心理学:例如,Peter Zijlstra,个人访谈,2014 年 4 月 17 日。
programmers have turned to psychology: E.g., Peter Zijlstra, personal interview, April 17, 2014.
计算机本身也会做类似的事情: Linux 在 2007 年增加了对计时器合并的支持;微软在 2009 年从 Windows 7 开始在 Windows 中加入了计时器合并功能;苹果在 2013 年的 OS X Mavericks 中也效仿了这一做法。
Computers themselves do something like this: Linux added support for timer coalescing in 2007; Microsoft included it in Windows starting with Windows 7 in 2009; and Apple followed suit in OS X Mavericks in 2013.
“只是你的算法中的一行错误”: Peter Norvig,个人采访,2014 年 9 月 17 日。
“just a one-line bug in your algorithm”: Peter Norvig, personal interview, September 17, 2014.
“我不会换进换出”:莎莎和拉泽尔,《疯狂》,101。
“I don’t swap in and out”: Shasha and Lazere, Out of Their Minds, 101.
“我的职责是深入了解事物的本质”: Donald Knuth,《Knuth 与电子邮件》,http://www-cs-faculty.stanford.edu/~uno/email.html。
“my role is to be on the bottom of things”: Donald Knuth, “Knuth versus Email,” http://www-cs-faculty.stanford.edu/~uno/email.html.
6.贝叶斯规则
6. BAYES’S RULE
“所有人类知识都是不确定的”:伯特兰·罗素,《人类知识:其范围和局限性》,1948 年,第 527 页。
“All human knowledge is uncertain”: Bertrand Russell, Human Knowledge: Its Scope and Limits, 1948, p. 527.
在那里,他看到了柏林墙:戈特,“哥白尼原理对我们未来前景的启示。”
There he saw the Berlin Wall: Gott, “Implications of the Copernican Principle for Our Future Prospects.”
“数据的不合理有效性”:该演讲源自 Halevy、Norvig 和 Pereira 的“数据的不合理有效性”。
“The Unreasonable Effectiveness of Data”: The talk was derived from Halevy, Norvig, and Pereira, “The Unreasonable Effectiveness of Data.”
“这些论证必定只是可能的”: 《人类理解论》,§IV,“关于理解运作的怀疑论”。
“these arguments must be probable only”: An Enquiry Concerning Human Understanding, §IV, “Sceptical Doubts Concerning the Operations of the Understanding.”
贝叶斯自身的历史:我们的简短传记借鉴了戴尔的《逆概率史》和贝尔豪斯的《托马斯·贝叶斯牧师》。
Bayes’s own history: Our brief biography draws on Dale, A History of Inverse Probability, and Bellhouse, “The Reverend Thomas Bayes.”
发表在 1746 年、1747 年、1748 年或 1749 年:贝叶斯的传奇论文没有日期,被夹在 1746 年和 1749 年的两篇论文之间。例如,参见 McGrayne 的《永不消亡的理论》。
in either 1746, ’47, ’48, or ’49: Bayes’s legendary paper, undated, had been filed between a pair of papers dated 1746 and 1749. See, e.g., McGrayne, The Theory That Would Not Die.
为牛顿新奇的“微积分”辩护: 流数学说简介,以及数学家对分析师作者的反对意见的辩护,因为它们被认为会影响他们的一般推理方法。
defense of Newton’s newfangled “calculus”: An Introduction to the Doctrine of fluxions, and Defence of the Mathematicians against the Objections of the Author of the analyst, so far as they are assigned to affect their general methods of Reasoning.
“值得保存”:贝叶斯简介,“一篇关于解决机会主义问题的文章。”
“deserves to be preserved”: Introduction to Bayes, “An Essay Towards Solving a Problem in the Doctrine of Chances.”
“空白 与 奖品的比例”:同上附录。
“the proportion of Blanks to Prizes”: Appendix to ibid.
我们首先需要 向前推理:准确地说,贝叶斯认为,给定假设h和一些观测数据d,我们应该通过计算每个h的似然值p ( d | h ) 来评估这些假设。(符号p ( d | h ) 表示给定h时d的“条件概率” ——即,如果h为真,则观察到d 的概率。)为了将其转换回每个h为真的概率,我们随后除以这些似然值之和。
we need to first reason forward: To be precise, Bayes was arguing that given hypotheses h and some observed data d, we should evaluate those hypotheses by calculating the likelihood p(d|h) for each h. (The notation p(d|h) means the “conditional probability” of d given h—that is, the probability of observing d if h is true.) To convert this back into a probability of each h being true, we then divide by the sum of these likelihoods.
拉普拉斯出生于诺曼底:有关拉普拉斯的生活和工作的更多详细信息,请参阅吉利斯皮,皮埃尔·西蒙·拉普拉斯。
Laplace was born in Normandy: For more details on Laplace’s life and work, see Gillispie, Pierre-Simon Laplace.
归结为一个估计值:拉普拉斯定律是通过贝叶斯建议的计算方法推导出来的——其中棘手的部分是对所有假设求和,这涉及到分部积分的一个有趣应用。你可以在格里菲斯、肯普和特南鲍姆合著的《贝叶斯认知模型》中看到拉普拉斯定律的完整推导。从现代贝叶斯统计学的角度来看,拉普拉斯定律是使用均匀先验概率的二项式概率的后验均值。
distilled down to a single estimate: Laplace’s Law is derived by working through the calculation suggested by Bayes—the tricky part is the sum over all hypotheses, which involves a fun application of integration by parts. You can see a full derivation of Laplace’s Law in Griffiths, Kemp, and Tenenbaum, “Bayesian Models of Cognition.” From the perspective of modern Bayesian statistics, Laplace’s Law is the posterior mean of the binomial rate using a uniform prior.
如果你只尝试一次就成功了:你可能还记得,在第二章中关于多臂老虎机和探索/利用困境的讨论中,我们还谈到了基于一系列经验来估计一个过程(比如老虎机)的成功率。贝叶斯和拉普拉斯的工作支撑了我们在该章中讨论的许多算法,包括基廷斯指数。与拉普拉斯定律一样,我们在那里提出的基廷斯指数的值假设任何成功的概率都是等概率的。这隐含地假设一台记录为1-0的老虎机的预期总赢率为三分之二。
If you try only once and it works out: You may recall that in our discussion of multi-armed bandits and the explore/exploit dilemma in chapter 2, we also touched on estimates of the success rate of a process—a slot machine—based on a set of experiences. The work of Bayes and Laplace undergirds many of the algorithms we discussed in that chapter, including the Gittins index. Like Laplace’s Law, the values of the Gittins index we presented there assumed that any probability of success is equally likely. This implicitly takes the expected overall win rate for a slot machine with a 1–0 record to be two-thirds.
“并不比其他事物更一致或更可想象”: 《人类理解论》,§IV,“对理解运作的怀疑”。
“no more consistent or conceivable than the rest”: An Enquiry Concerning Human Understanding, §IV, “Sceptical Doubts Concerning the Operations of the Understanding.”
真正艰巨的任务是由拉普拉斯完成的:公平地说,1950 年一篇颇具影响力的论文(Bailey,可信度程序)提到了“拉普拉斯对贝叶斯规则的推广”,但这一说法并没有得到广泛的认同。新发现以发现者以外的人的名字命名是一种相当普遍的现象,统计学家和历史学家斯蒂芬·斯蒂格勒 (Stephen Stigler) 断言,这应该被视为一条经验定律——斯蒂格勒的同名定律。当然,斯蒂格勒并不是第一个发现这一点的人;他将这一成就归功于社会学家罗伯特·K·默顿 (Robert K. Merton)。参见斯蒂格勒的“斯蒂格勒的同名定律”。
the real heavy lifting was done by Laplace: In fairness, an influential 1950 paper (Bailey, Credibility Procedures) referred to “Laplace’s Generalization of Bayes’s Rule,” but it didn’t quite stick. Discoveries being named after somebody other than their discoverer is a sufficiently common phenomenon that statistician and historian Stephen Stigler has asserted that it should be considered an empirical law—Stigler’s Law of Eponymy. Of course, Stigler wasn’t the first person to discover this; he assigns the credit to sociologist Robert K. Merton. See Stigler, “Stigler’s Law of Eponymy.”
将它们的概率相乘:对于数学爱好者,这是贝叶斯规则的完整版本。我们想要计算给定数据d时,假设h 的概率有多大。我们对该假设成立的概率有先验信念,用先验分布p ( h ) 表示。我们要计算的是“后验”分布p ( h | d ),它指示我们应该如何根据d提供的证据更新先验分布。它由下式给出
multiply their probabilities together: For the mathematically inclined, here’s the full version of Bayes’s Rule. We want to calculate how much probability to assign a hypothesis h given data d. We have prior beliefs about the probability of that hypothesis being true, expressed in a prior distribution p(h). What we want to compute is the “posterior” distribution, p(h|d), indicating how we should update our prior distribution in light of the evidence provided by d. This is given by
其中h ′ 涵盖所考虑的全部假设。
where h′ ranges over the full set of hypotheses under consideration.
“尤其是关于未来”:这句谚语的不确定起源在Quote Investigator 的“很难做出预测,尤其是关于未来”中有详细描述, http://quoteinvestigator.com/2013/10/20/no-predict/。
“especially about the future”: The uncertain origins of this saying are described in detail in Quote Investigator, “It’s Difficult to Make Predictions, Especially About the Future,” http://quoteinvestigator.com/2013/10/20/no-predict/.
如果真的有纽约市,那就太令人惊讶了:《纽约客》的封面是理查德·麦奎尔 (Richard McGuire) 的《时间扭曲》,2014 年 11 月 24 日。有关城市和企业可能寿命的更有趣和更详细的分析,请参阅杰弗里·韦斯特 (Geoffrey West) 和路易斯·贝滕科特 (Luis Bettencourt) 的作品——例如,贝滕科特等人的《增长、创新、扩展和城市生活节奏》。
surprising if there were even a New York City: The New Yorker cover is Richard McGuire, “Time Warp,” November 24, 2014. For a fascinating and more detailed analysis of the probable life spans of cities and corporations, see the work of Geoffrey West and Luis Bettencourt—e.g., Bettencourt et al., “Growth, Innovation, Scaling, and the Pace of Life in Cities.”
大量批评性信件:例如,参见 Garrett 和 Coles 的《贝叶斯归纳推理和人择原理》和 Buch 的《未来前景讨论》。
a flurry of critical correspondence: For example, see Garrett and Coles, “Bayesian Inductive Inference and the Anthropic Principles” and Buch, “Future Prospects Discussed.”
一场你一无所知的抽奖:统计学家 Harold Jeffreys 后来建议不要使用拉普拉斯的( w +1) ⁄ ( n +2),而要使用( w +0.5) ⁄ ( n +1),这是因为使用了“无信息”先验而不是“均匀”先验(Jeffreys,《概率论》;Jeffreys,“估计问题中先验概率的不变形式”)。定义更具信息量的先验的一种方法会导致形式为( w + w ′+1) ⁄ ( n + n ′+2)的预测,其中w ′ 和n ′ 是您过去经验中类似过程的获胜次数和尝试次数(有关详细信息,请参阅 Griffiths、Kemp 和 Tenenbaum 的“贝叶斯认知模型”)。按照这条规则,如果你之前看过100次彩票抽奖,每次只有10张中奖彩票(w = 10,n = 100),那么在看过一次新彩票的中奖后,你的估计会是更合理的12/103(离10%不远)。拉普拉斯定律的变体在计算语言学中被广泛使用,它们提供了一种方法来估计从未见过的单词的概率(Chen 和 Goodman,《语言建模平滑技术的实证研究》)。
a raffle where you come in knowing nothing: The statistician Harold Jeffreys would later suggest, instead of Laplace’s (w+1)⁄(n+2), using rather (w+0.5)⁄(n+1), which results from using an “uninformative” prior rather than the “uniform” prior (Jeffreys, Theory of Probability; Jeffreys, “An Invariant Form for the Prior Probability in Estimation Problems”). One method for defining more informative priors results in predictions of the form (w+w′+1)⁄(n+n′+2), where w′ and n′ are the number of wins and attempts for similar processes in your past experience (for details see Griffiths, Kemp, and Tenenbaum, “Bayesian Models of Cognition”). Using this rule, if you had previously seen 100 lottery drawings with only 10 winning tickets (w = 10, n = 100), your estimate after seeing a single winning draw for this new lottery would be a much more reasonable 12/103 (not far from 10%). Variants on Laplace’s Law are used extensively in computational linguistics, where they provide a way to estimate the probabilities of words that have never been seen before (Chen and Goodman, “An Empirical Study of Smoothing Techniques for Language Modeling”).
或持续五千年:对于像持续时间这样的量,其范围从 0 到 ∞,时间t的无信息先验是概率密度p ( t ) ∝ 1/ t。改变尺度 - 定义一个是t倍数的新量s -不会改变此分布的形式:如果s = ct,则p ( s ) ∝ p ( t = s/c ) ∝ 1 / s。这意味着它是尺度不变的。更多关于无信息先验的信息出现在 Jeffreys 的《概率论》和 Jeffreys 的“估计问题中先验概率的不变形式”中。
or last for five millennia: For a quantity like a duration, which ranges from 0 to ∞, the uninformative prior on times t is the probability density p(t) ∝ 1/t. Changing the scale—defining a new quantity s that is a multiple of t—doesn’t change the form of this distribution: if s = ct, then p(s) ∝ p(t = s/c) ∝ 1/s. This means that it is scale-invariant. Lots more information on uninformative priors appears in Jeffreys, Theory of Probability, and Jeffreys, “An Invariant Form for the Prior Probability in Estimation Problems.”
哥白尼原理出现:这一点由戈特在《未来前景讨论》中回应布赫在《未来前景讨论》中表明。
the Copernican Principle emerges: This was shown by Gott, “Future Prospects Discussed,” in responding to Buch, “Future Prospects Discussed.”
确定电车数量: Jeffreys,《概率论》,§4.8。Jeffreys感谢数学家Max Newman向他提出了这个问题。
determining the number of tramcars: Jeffreys, Theory of Probability, §4.8. Jeffreys credits mathematician Max Newman for bringing the problem to his attention.
试图估算坦克的数量:这被称为“德国坦克问题”,并已在多个来源中得到记录。例如,请参阅加文·戴维斯,《卫报》,2006年7月19日,《卫报》 , http://www.theguardian.com/world/2006/jul/20/secondworldwar.tvandradio。
sought to estimate the number of tanks: This has come to be known as the “German Tank Problem,” and has been documented in a number of sources. See, e.g., Gavyn Davies, “How a Statistical Formula won the War,” the Guardian, July 19, 2006, http://www.theguardian.com/world/2006/jul/20/secondworldwar.tvandradio.
果园里的水果:例如,2002 年新西兰鳄梨种植者协会年度研究报告发现,“到 4 月份,水果大小分布呈正态分布,并且在剩余的监测期内一直保持这种状态。”
fruits in an orchard: For instance, the 2002 New Zealand Avocado Growers Association Annual Research Report found that “by April, fruit size profiles were normally distributed and remained so for the remainder of the monitored period.”
一个城镇的平均人口:这个数字来自于 Clauset、Shalizi 和 Newman 的《经验数据中的幂律分布》,该书又引用了 2000 年美国人口普查数据。
The average population of a town: This figure comes from Clauset, Shalizi, and Newman, “Power-Law Distributions in Empirical Data,” which in turn cites the 2000 US Census.
可以合理地涵盖多个尺度:对于一个量t,幂律分布的一般形式是p ( t )∝t − γ ,其中γ的值描述了t的概率随着t 的增大而下降的速度。与无信息先验一样,如果我们取s = ct,改变尺度,分布的形式不会改变。
can plausibly range over many scales: The general form of a power-law distribution on a quantity t is p(t) ∝ t−γ, where the value of γ describes how quickly the probability of t decreases as t gets larger. As with the uninformative prior, the form of the distribution doesn’t change if we take s = ct, changing the scale.
充满幂律的领域:财富按照幂律函数分配的观察结果归功于帕累托,《政治经济学教程》。西蒙的另一篇关于人口和收入幂律分布的精彩讨论是《论一类倾斜分布函数》。
a domain full of power laws: The observation that wealth is distributed according to a power-law function is credited to Pareto, Cours d’économie politique. Another good discussion of the power-law distributions of populations and incomes is Simon, “On a Class of Skew Distribution Functions.”
美国的平均收入:根据美国国税局 (IRS) 申报的数据,2009 纳税年度(有最新估算值的年份)的平均个人调整后总收入 (AGI) 估计为 55,688 美元;请参阅 2011 年工作论文“评估新当前人口调查年度社会和经济补充问题在人口普查局税收模型中的使用情况”,网址为https://www.census.gov/content/dam/Census/library/working-papers/2011/demo/2011_SPM_Tax_Model.pdf,该论文引用了美国人口普查局 2010 年当前人口调查年度社会和经济补充数据。
The mean income in America: The mean individual adjusted gross income (AGI), derived from IRS filings, was estimated to be $55,688 for the 2009 tax year, the most recent year for which an estimate was available; see the 2011 working paper “Evaluating the Use of the New Current Population Survey’s Annual Social and Economic Supplement Questions in the Census Bureau Tax Model,” available at https://www.census.gov/content/dam/Census/library/working-papers/2011/demo/2011_SPM_Tax_Model.pdf, which in turn cites data from the US Census Bureau’s 2010 Current Population Survey Annual Social and Economic Supplement.
三分之二的美国人口收入低于平均水平: 2012年调整总收入(AGI)前40%的门槛值为47,475美元,前30%的门槛值为63,222美元。由此我们可以推断,如果AGI为55,688美元,则大约属于前33%。参见Adrian Dungan,《2012年个人所得税份额》,《美国国税局收入统计公报》 ,2015年春季,网址:https://www.irs.gov/pub/irs-soi/soi-a-ints-id1506.pdf。
two-thirds of the US population make less than the mean income: The cutoff for the top 40% of AGI in 2012 was $47,475, and the cutoff for the top 30% was $63,222, from which we can infer that an AGI of $55,688 lands at approximately the top 33%. See Adrian Dungan, “Individual Income Tax Shares, 2012,” IRS Statistics of Income Bulletin, Spring 2015, available at https://www.irs.gov/pub/irs-soi/soi-a-ints-id1506.pdf.
最顶层 1% 的收入几乎是平均水平的十倍: 2012 年,最顶层 1% 的截止标准是调整总收入 434,682 美元,而最顶层 0.01% 的截止标准是 12,104,014 美元。同上。
the top 1% make almost ten times the mean: The cutoff for the top 1% was an AGI of $434,682 in 2012, and the cutoff for the top 0.01% was $12,104,014. Ibid.
“优先依附”的过程:关于优先依附中出现的幂律分布的想法,可以在 Barabási 的Linked中找到一个很好的一般观众讨论。
the process of “preferential attachment”: A good general-audience discussion of the idea of power-law distributions emerging from preferential attachment can be found in Barabási, Linked.
“‘可以永远持续下去’是一种好的方式吗?”:勒纳,《利希滕贝格图形》。
“‘could go on forever’ in a good way?”: Lerner, The Lichtenberg Figures.
适当的预测策略是乘法规则:本节讨论的所有预测规则均源自 Griffiths 和 Tenenbaum 的《日常认知中的最佳预测》。
appropriate prediction strategy is a Multiplicative Rule: All the prediction rules discussed in this section are derived in Griffiths and Tenenbaum, “Optimal Predictions in Everyday Cognition.”
诗歌遵循更接近幂律的规律:同上。
poems follow something closer to a power-law: Ibid.
形式化地定义了间隔的分布:埃尔朗在《概率论与电话对话》中首次使用泊松分布对网络上出现的电话呼叫的速率进行建模,并在《自动电话交换机中重要性概率理论中的一些问题的解决方案》中开发了同名的埃尔朗分布,用于对到达呼叫之间的间隔进行建模。有关埃尔朗生平的更多详细信息,请参阅 Heyde 的《阿格纳·克拉鲁普·埃尔朗》。
formalized the spread of intervals: Erlang first modeled the rate of phone calls appearing on a network using a Poisson distribution in “The Theory of Probabilities and Telephone Conversations,” and in turn developed the eponymous Erlang distribution for modeling the intervals between arriving calls in “Solution of Some Problems in the Theory of Probabilities of Significance in Automatic Telephone Exchanges.” For more details on Erlang’s life, see Heyde, “Agner Krarup Erlang.”
赔率约为 20 比 1:准确地说,在同名游戏中拿到黑杰克的概率恰好是 2,652 比 128,即约为 20.7 比 1。为了弄明白为什么这会导致在拿到黑杰克之前期望玩 20.7 手,我们可以递归地定义我们的期望:要么我们拿到黑杰克,结果为 1,要么没有(在这种情况下,我们会在一手牌后回到起点)。如果x是我们的期望,则x = 1 + (2524/2652) x ,其中 2524/2652 是我们没有拿到黑杰克的概率。解x得出的结果是 20.7。
odds of which are about 20 to 1: To be precise, the odds against being dealt a blackjack hand in the eponymous game are exactly 2,652 to 128, or about 20.7 to 1. To see the derivation of why this leads to an expectation of playing 20.7 hands before getting it, we can define our expectation recursively: either we land blackjack for a result of 1, or we don’t (in which case we’re back where we started one hand later). If x is our expectation, x = 1 + (2524/2652)x, where 2524/2652 is our chance of not getting dealt blackjack. Solving for x gives about 20.7.
统计学家称之为“无记忆”的:从技术上讲,下一次二十一点的发生时间服从几何分布(类似于连续量的指数分布),该分布不断减小,而不是我们在正文中描述的更像翼状的埃尔朗分布。然而,在适当的情况下,两者都可以产生无记忆预测。如果我们在某个特定现象持续时间的某个随机点遇到它,就像戈特对柏林墙的假设一样,那么翼状的埃尔朗分布会给我们无记忆的加法规则预测。如果我们持续观察一个服从几何分布的现象,比如在玩二十一点游戏时,也会产生同样的加法规则预测。
known to statisticians as “memoryless”: Technically, the time to the next blackjack follows a geometric distribution (similar to the exponential distribution for a continuous quantity), which is constantly decreasing, rather than the more wing-like Erlang distribution we describe in the main text. However, both can yield memoryless predictions under the right circumstances. If we encounter a particular phenomenon at some random point in its duration, as Gott assumed regarding the Berlin Wall, then the wing-like Erlang gives us memoryless Additive Rule predictions. And if we continuously observe a phenomenon that has a geometric distribution, as in playing a game of blackjack, the same kind of Additive Rule predictions result.
肯尼·罗杰斯曾有句名言: “《赌徒》”最广为人知的歌曲是肯尼·罗杰斯1978年发行的同名专辑《赌徒》,但这首歌最初是由唐·施利茨创作和演唱的。罗杰斯录制的这首歌后来登上了公告牌乡村音乐排行榜的榜首,并于1980年荣获格莱美最佳乡村男歌手奖。
Kenny Rogers famously advised: “The Gambler” is best known as sung by Kenny Rogers on his 1978 album of the same name, but it was originally written and performed by Don Schlitz. The Rogers recording of the song would go on to reach the top spot on the Billboard country charts, and win the 1980 Grammy for Best Male Country Vocal Performance.
“我长舒一口气”:古尔德,《中位数不是信息》。
“I breathed a very long sigh of relief”: Gould, “The Median Isn’t the Message.”
要求人们做出预测: Griffiths 和 Tenenbaum,“日常认知中的最佳预测”。
asking people to make predictions: Griffiths and Tenenbaum, “Optimal Predictions in Everyday Cognition.”
人们在广泛范围内的先验分布:例如,研究已经探讨了我们如何从落在视网膜上的光模式中识别移动的形状,如何从物体之间的相互作用中推断因果关系,以及如何在看过几次新词后学习其含义。分别参见Weiss、Simoncelli和Adelson的《运动错觉作为最佳感知》;Griffiths等人的《贝叶斯和Blickets》;以及Xu和Tenenbaum的《词汇学习作为贝叶斯推理》。
people’s prior distributions across a broad swath: Studies have examined, for example, how we manage to identify moving shapes from the patterns of light that fall on the retina, infer causal relationships from the interactions between objects, and learn the meaning of new words after seeing them just a few times. See, respectively, Weiss, Simoncelli, and Adelson, “Motion Illusions as Optimal Percepts”; Griffiths et al., “Bayes and Blickets”; Xu and Tenenbaum, “Word Learning as Bayesian Inference.”
著名的“棉花糖测试”: Mischel、Ebbesen 和 Raskoff Zeiss,“延迟满足的认知和注意力机制”。
famous “marshmallow test”: Mischel, Ebbesen, and Raskoff Zeiss, “Cognitive and Attentional Mechanisms in Delay of Gratification.”
一切都取决于具体情况: McGuire 和 Kable,“决策者根据时间间隔经验校准行为持久性”,以及 McGuire 和 Kable,“理性的时间预测可能导致延迟满足明显失败”。
all depends on what kind of situation: McGuire and Kable, “Decision Makers Calibrate Behavioral Persistence on the Basis of Time-Interval Experience,” and McGuire and Kable, “Rational Temporal Predictions Can Underlie Apparent Failures to Delay Gratification.”
成长为更成功的年轻人:米歇尔、肖达和罗德里格斯,《儿童的延迟满足》。
grew into young adults who were more successful: Mischel, Shoda, and Rodriguez, “Delay of Gratification in Children.”
先前的经历如何影响行为: Kidd、Palmeri 和 Aslin,“理性零食”。
how prior experiences might affect behavior: Kidd, Palmeri, and Aslin, “Rational Snacking.”
卡内基音乐厅甚至半满:根据航空安全网络(私人信件)的数据,2000年至2014年期间,“可搭载12名以上乘客的美国飞机,包括公务机和军用运输机”的死亡人数为1,369人。再加上2014年的数字,估算2015年的死亡人数,截至2015年底,总死亡人数估计为1,393人。卡内基音乐厅著名的艾萨克·斯特恩礼堂可容纳2,804人;请参阅http://www.carnegiehall.org/Information/Stern-Auditorium-Perelman-Stage/。
Carnegie Hall even half full: According to figures from the Aviation Safety Network (personal correspondence), the number of fatalities “on board US-owned aircraft that are capable of carrying 12+ passengers, also including corporate jets and military transport planes” during the period 2000–2014 was 1,369, and adding the 2014 figure again to estimate deaths in 2015 yields a total estimate of 1,393 through the end of 2015. Carnegie Hall’s famous Isaac Stern Auditorium seats 2,804; see http://www.carnegiehall.org/Information/Stern-Auditorium-Perelman-Stage/.
超过怀俄明州总人口:根据美国国家公路交通安全管理局的数据,2000年至2013年间,美国共有543,407人死于车祸。请参阅http://www-fars.nhtsa.dot.gov。重复2013年的数据来估算2014年和2015年的死亡人数,得出截至2015年底的死亡人数估计为608,845人。美国人口普查局估计,2014年怀俄明州的人口为584,153人。请参阅http://quickfacts.census.gov/qfd/states/56000.html。
greater than the entire population of Wyoming: According to the National Highway Traffic Safety Administration, 543,407 people died in car accidents in the United States in the years 2000–2013. See http://www-fars.nhtsa.dot.gov. Repeating the 2013 figure to estimate deaths in 2014 and 2015 yields an estimate of 608,845 deaths through the end of 2015. The 2014 population of Wyoming, as estimated by the US Census Bureau, was 584,153. See http://quickfacts.census.gov/qfd/states/56000.html.
美国新闻中的枪支暴力:格拉斯纳,《散布恐惧的叙事技巧》。
gun violence on American news: Glassner, “Narrative Techniques of Fear Mongering.”
7.过度拟合
7. OVERFITTING
“结婚——结婚——结婚 QED”:达尔文的这份笔记的日期是 1838 年 4 月 7 日;参见例如,达尔文,《查尔斯·达尔文通信集》,第 2 卷:1837-1843 年。
“Marry—Marry—Marry Q.E.D.”: This note by Darwin is dated April 7, 1838; see, e.g., Darwin, The Correspondence of Charles Darwin, Volume 2: 1837–1843.
“道德或审慎代数”:富兰克林写给约瑟夫·普利斯特利的信,伦敦,1772 年 9 月 19 日。
“Moral or Prudential Algebra”: Franklin’s letter to Joseph Priestley, London, September 19, 1772.
“你能做的任何事我都能做得更好”: “你能做的任何事”,由欧文·柏林 (Irving Berlin) 创作,收录于1946 年的《安妮拿起你的枪》中。
“Anything you can do I can do better”: “Anything You Can Do,” composed by Irving Berlin, in Annie Get Your Gun, 1946.
你知道什么和你不知道什么:用机器学习研究人员的语言来说就是“训练”和“测试”。
what you know and what you don’t: In the language of machine-learning researchers: the “training” and the “test.”
德国最近进行的一项研究: Lucas等人,“重新审视适应和幸福的设定点模型”。
a recent study conducted in Germany: Lucas et al., “Reexamining Adaptation and the Set Point Model of Happiness.”
我们的任务是找出公式:对于数学爱好者来说,我们试图找到一个能够捕捉这种关系的最佳多项式函数。设婚后时间长度为x,满意度为y,则单预测模型为y = ax + b。双预测模型为y = ax 2 + bx + c ,而九预测模型则会找到x到x 9的所有值的最佳系数,从而估算出一个 9 次多项式。
our job is to figure out the formula: For math aficionados, we’re trying to find the best polynomial function for capturing this relationship. Taking time since marriage to be x and satisfaction to be y, the one-predictor model is y = ax + b. The two-predictor model is y = ax2 + bx + c, and the nine-predictor model finds the best coefficients for all values of x up to x9, estimating a polynomial of degree 9.
通过图表上的每个点:事实上,这是一个数学真理,你总是可以通过任意n个点绘制一个n -1 次多项式。
through each and every point on the chart: In fact, it’s a mathematical truth that you can always draw a polynomial of degree n − 1 through any n points.
人们的基线满意度水平: Lucas 等人,“重新审视适应性和幸福的设定点模型”。
people’s baseline level of satisfaction: Lucas et al., “Reexamining Adaptation and the Set Point Model of Happiness.”
使用更复杂的模型并不总是更好:统计学家将模型中的各种因素称为“预测因子”。过于简单的模型,例如试图用直线拟合曲线,被称为“偏差”。相反的系统性误差,即模型过于复杂,因此会因为数据的细微变化而发生剧烈波动,被称为“方差”。
not always better to use a more complex model: Statisticians refer to the various factors in the model as “predictors.” A model that’s too simple, such as a straight line attempting to fit a curve, is said to exhibit “bias.” The opposite kind of systemic error, where a model is made too complicated and therefore gyrates wildly because of small changes in the data, is known as “variance.”
令人惊讶的是,这两种误差——偏差和方差——可以互补。降低偏差(使模型更加灵活和复杂)可以增加方差。而增加偏差(简化模型,降低数据拟合的紧密度)有时可以降低方差。
The surprise is that these two kinds of errors—bias and variance—can be complementary. Reducing bias (making the model more flexible and complicated) can increase variance. And increasing bias (simplifying the model and fitting the data less tightly) can sometimes reduce variance.
粒子物理学中著名的海森堡不确定性原理指出,你对粒子动量了解得越多,你对其位置了解得越少。正如它所说,所谓的偏差-方差权衡表达了模型优劣的深层基础界限——即模型能够了解和预测什么。这一概念在机器学习文献中随处可见。例如,参见 Geman、Bienenstock 和 Doursat 的《神经网络与偏差/方差困境》以及 Grenander 的《论随机过程的经验谱分析》。
Like the famous Heisenberg uncertainty principle of particle physics, which says that the more you know about a particle’s momentum the less you know about its position, the so-called bias-variance tradeoff expresses a deep and fundamental bound on how good a model can be—on what it’s possible to know and to predict. This notion is found in various places in the machine-learning literature. See, for instance, Geman, Bienenstock, and Doursat, “Neural Networks and the Bias/Variance Dilemma,” and Grenander, “On Empirical Spectral Analysis of Stochastic Processes.”
在《列王记》中:被称为 Nehushtan 的铜蛇在《列王记下》第 18 章第 4 节中被毁灭。
in the Book of Kings: The bronze snake, known as Nehushtan, gets destroyed in 2 Kings 18:4.
“花大价钱去除纹身”:吉尔伯特,《偶然发现的幸福》。
“pay good money to remove the tattoos”: Gilbert, Stumbling on Happiness.
不到五十年前的决斗:如果您不是太胆小,您可以观看 1967 年的一场决斗的视频,网址为http://passerelle-production.u-bourgogne.fr/web/atip_insulte/Video/archive_duel_france.swf。
duels less than fifty years ago: If you’re not too fainthearted, you can watch video of a duel fought in 1967 at http://passerelle-production.u-bourgogne.fr/web/atip_insulte/Video/archive_duel_france.swf.
因为运动员的战术过度拟合:有关故意过度拟合击剑的有趣例子,请参阅 Harmenberg 的Epee 2.0。
as athletes overfit their tactics: For an interesting example of very deliberately overfitting fencing, see Harmenberg, Epee 2.0.
“激励结构有效”: Brent Schlender,《丢失的史蒂夫·乔布斯录音带》,《Fast Company 》 ,2012 年 5 月,http://www.fastcompany.com/1826869/lost-steve-jobs-tapes。
“Incentive structures work”: Brent Schlender, “The Lost Steve Jobs Tapes,” Fast Company, May 2012, http://www.fastcompany.com/1826869/lost-steve-jobs-tapes.
“无论 CEO 决定衡量什么”: Sam Altman,《欢迎、想法、产品、团队和执行第一部分》,斯坦福 CS183B,2014 年秋季,“如何创办一家初创公司”,http://startupclass.samaltman.com/courses/lec01/。
“whatever the CEO decides to measure”: Sam Altman, “Welcome, and Ideas, Products, Teams and Execution Part I,” Stanford CS183B, Fall 2014, “How to Start a Startup,” http://startupclass.samaltman.com/courses/lec01/.
Ridgway 列举了大量这样的情况: Ridgway,“绩效衡量的不良后果”。
Ridgway cataloged a host of such: Ridgway, “Dysfunctional Consequences of Performance Measurements.”
在一家职业介绍公司:在这个故事中,里奇韦本人引用了布劳的《官僚主义的动态》。
At a job-placement firm: In this tale, Ridgway is himself citing Blau, The Dynamics of Bureaucracy.
“朋友不会让朋友衡量页面浏览量”: Avinash Kaushik,“你就是你所衡量的,所以要明智地选择你的 KPI(激励措施)!” http://www.kaushik.net/avinash/measure-choose-smarter-kpis-incentives/。
“Friends don’t let friends measure Page Views”: Avinash Kaushik, “You Are What You Measure, So Choose Your KPIs (Incentives) Wisely!” http://www.kaushik.net/avinash/measure-choose-smarter-kpis-incentives/.
“发现警察尸体”:格罗斯曼和克里斯滕森著,《论战斗》。参见http://www.killology.com/on_combat_ch2.htm。
“dead cops were found”: Grossman and Christensen, On Combat. See http://www.killology.com/on_combat_ch2.htm.
警官本能地抓住了枪:同上。
officer instinctively grabbed the gun: Ibid.
“如果你不能简单地解释它”:这句话经常被认为是阿尔伯特·爱因斯坦说的,尽管这种说法很可能是伪造的。
“If you can’t explain it simply”: This quotation is frequently attributed to Albert Einstein, although this attribution is likely to be apocryphal.
Tikhonov 提出了一个答案:例如,参见 Tikhonov 和 Arsenin 的《不适定问题的解决方案》。
Tikhonov proposed one answer: See, e.g., Tikhonov and Arsenin, Solution of Ill-Posed Problems.
由生物统计学家 Robert Tibshirani 于 1996 年发明: Tibshirani,“通过套索进行回归收缩和选择”。
invented in 1996 by biostatistician Robert Tibshirani: Tibshirani, “Regression Shrinkage and Selection via the Lasso.”
人类大脑消耗大约五分之一的能量:有关人类大脑能量消耗的更多信息,请参见 Raichle 和 Gusnard 的《评估大脑的能量预算》,其中又引用了 Clarke 和 Sokoloff 的《大脑的循环和能量代谢》。
human brain burns about a fifth: For more on the human brain’s energy consumption see, e.g., Raichle and Gusnard, “Appraising the Brain’s Energy Budget,” which in turn cites, e.g., Clarke and Sokoloff, “Circulation and Energy Metabolism of the Brain.”
大脑试图最小化神经元的数量:利用这种受神经启发的策略(称为“稀疏编码”),研究人员开发出了具有与视觉皮层神经元相似特性的人工神经元。参见 Olshausen 和 Field 的“单细胞受体场特性的出现”。
brains try to minimize the number of neurons: Using this neurally inspired strategy (known as “sparse coding”), researchers have developed artificial neurons that have properties similar to those found in the visual cortex. See Olshausen and Field, “Emergence of Simple-Cell Receptive Field Properties.”
开创性的“均值-方差投资组合优化”:马科维茨获得诺贝尔奖的工作出现在他的论文“投资组合选择”和他的书“投资组合选择:有效的投资多元化”中。
groundbreaking “mean-variance portfolio optimization”: The work for which Markowitz was awarded the Nobel Prize appears in his paper “Portfolio Selection” and his book Portfolio Selection: Efficient Diversification of Investments.
“我将我的捐款五五分成”: Harry Markowitz,引自 Jason Zweig 的《大脑如何在 TIAA-CREF 进行投资》,Money 27(1): 114, 1998 年 1 月。
“I split my contributions fifty-fifty”: Harry Markowitz, as quoted in Jason Zweig, “How the Big Brains Invest at TIAA–CREF,” Money 27(1): 114, January 1998.
“更少的信息、计算和时间”: Gigerenzer 和 Brighton,《Homo Heuristicus》。
“less information, computation, and time”: Gigerenzer and Brighton, “Homo Heuristicus.”
从 1990 年代中期到 2013 年增长了四倍多:摘自北美大豆食品协会的“销售和趋势”,http://www.soyfoods.org/soy-products/sales-and-trends,其中引用了“由 Katahdin Ventures 进行”的研究。
more than quadrupled from the mid-1990s to 2013: From Soyfoods Association of North America, “Sales and Trends,” http://www.soyfoods.org/soy-products/sales-and-trends, which in turn cites research “conducted by Katahdin Ventures.”
“坚果现在很流行”: Vanessa Wong,《可饮用的杏仁》,《彭博商业周刊》 ,2013 年 8 月 21 日。
“Nuts are trendy now”: Vanessa Wong, “Drinkable Almonds,” Bloomberg Businessweek, August 21, 2013.
自 2004 年以来增长了惊人的三百倍: Lisa Roolant,“为什么椰子水现在是一个价值 10 亿美元的产业”,TransferWise, https: //transferwise.com/blog/2014-05/why-coconut-water-is-now-a-1-billion-industry/。
an astounding three-hundred-fold since 2004: Lisa Roolant, “Why Coconut Water Is Now a $1 Billion Industry,” TransferWise, https://transferwise.com/blog/2014-05/why-coconut-water-is-now-a-1-billion-industry/.
“从无形变为不可避免”:大卫·西格尔,《椰子水引发的货架空间街头斗争》,《纽约时报》 ,2014 年 7 月 26 日。
“jumped from invisible to unavoidable”: David Segal, “For Coconut Waters, a Street Fight for Shelf Space,” New York Times, July 26, 2014.
羽衣甘蓝市场增长了 40%: “名厨强调健康益处,羽衣甘蓝销量飙升”,《每日电讯报》,2013 年 3 月 25 日
the kale market grew by 40%: “Sales of Kale Soar as Celebrity Chefs Highlight Health Benefits,” The Telegraph, March 25, 2013
必胜客将其放入沙拉吧: Ayla Withee,《羽衣甘蓝:为您的饮食添加更多超级食物的简单方法》,《波士顿杂志》 ,2012 年 5 月 31 日。
Pizza Hut, which put it in their salad bars: Ayla Withee, “Kale: One Easy Way to Add More Superfoods to Your Diet,” Boston Magazine, May 31, 2012.
早期脊椎动物的身体会旋转180度: Kinsbourne,《躯体扭转》。关于原始脊椎动物的身体和器官结构的进一步讨论,请参阅Lowe等人的《半索动物的背腹模式》。Kelly Zalocusky的《问问神经科学家:为什么神经系统会交叉?》更通俗易懂的概述,发表于斯坦福神经博客,2013年12月12日,https://neuroscience.stanford.edu/news/ask-neuroscientist-why-does-nervous-system-decussate。
early vertebrates’ bodies twisted 180 degrees: Kinsbourne, “Somatic Twist.” Further discussion of body and organ structure in primitive vertebrates can be found in Lowe et al., “Dorsoventral Patterning in Hemichordates.” A more approachable overview is Kelly Zalocusky, “Ask a Neuroscientist: Why Does the Nervous System Decussate?,” Stanford Neuroblog, December 12, 2013, https://neuroscience.stanford.edu/news/ask-neuroscientist-why-does-nervous-system-decussate.
颌骨显然被重新利用:例如,参见“哺乳动物祖先的颌骨到耳朵”,理解进化,http://evolution.berkeley.edu/evolibrary/article/evograms_05。
jawbones were apparently repurposed: See, for example, “Jaws to Ears in the Ancestors of Mammals,” Understanding Evolution, http://evolution.berkeley.edu/evolibrary/article/evograms_05.
“我们无法衡量重要的事情这一前提”: “明茨伯格先生的可怕世界”,西蒙·考尔金访谈,《卫报》,2003 年 1 月 25 日,http://www.theguardian.com/business/2003/jan/26/theobserver.observerbusiness11。
“the premise that we can’t measure what matters”: “The Scary World of Mr Mintzberg,” interview with Simon Caulkin, Guardian, January 25, 2003, http://www.theguardian.com/business/2003/jan/26/theobserver.observerbusiness11.
“人的一生就像一只中性蜜蜂”:达尔文,《查尔斯·达尔文通信集》,第 2 卷:1837-1843 年。
“one’s whole life like a neuter bee”: Darwin, The Correspondence of Charles Darwin, Volume 2: 1837–1843.
“何时?或早或晚”:同上。
“When? Soon or Late”: Ibid.
8.放松
8. RELAXATION
“成功设计肽类抑制剂”: Meghan Peterson(娘家姓Bellows),个人访谈,2014 年 9 月 23 日。
“successfully design a peptidic inhibitor”: Meghan Peterson (née Bellows), personal interview, September 23, 2014.
大约有 11,107种 可能的座位安排:更准确地说,如果我们为每个人独立分配座位,那么就有 11,107 种可能性。如果考虑到每张桌子只能坐 10 个人的限制,这个数字会稍微小一些。但仍然很大。
about 11107 possible seating plans: More precisely, there would be 11107 possibilities if we were choosing a table assignment for each person independently. The number is a little less once we take into account the constraint that only 10 people can sit at each table. But it’s still huge.
Bellows 对计算机的结果很满意: Meghan Bellows 用来解决她的婚礼座位表的正式框架在 Bellows 和 Peterson 的“寻找最佳座位表”中有描述。
Bellows was pleased with the computer’s results: The formal framework that Meghan Bellows used to solve her wedding seating chart is described in Bellows and Peterson, “Finding an Optimal Seating Chart.”
林肯曾担任“草原律师”:您可以在弗雷克的《真正的林肯公路》中阅读有关林肯巡回之路的更多信息。
Lincoln worked as a “prairie lawyer”: You can read more about Lincoln’s circuit in Fraker, “The Real Lincoln Highway.”
“邮政信使问题”:门格尔的《Das botenproblem》包含了门格尔于 1930 年 2 月 5 日在维也纳就此主题所做的演讲。有关旅行商问题的更完整历史,请参阅 Schrijver 的《组合优化的历史》以及库克的可读性极强的著作《追寻旅行商》。
“the postal messenger problem”: Menger, “Das botenproblem,” contains a lecture given by Menger on the subject in Vienna on February 5, 1930. For a fuller history of the traveling salesman problem see Schrijver, “On the History of Combinatorial Optimization,” as well as Cook’s very readable book In Pursuit of the Traveling Salesman.
数学家梅里尔·弗勒德(Merrill Flood):弗勒德,“旅行商问题”。
fellow mathematician Merrill Flood: Flood, “The Traveling-Salesman Problem.”
标志性的名字首次出现在印刷品中:罗宾逊,《论汉密尔顿博弈》。
iconic name first appeared in print: Robinson, On the Hamiltonian Game.
“不可能的结果也会很有价值”: Flood,《旅行商问题》。
“impossibility results would also be valuable”: Flood, “The Traveling-Salesman Problem.”
“没有解决旅行商问题的好算法”: Edmonds,《最佳分支》。
“no good algorithm for the traveling salesman problem”: Edmonds, “Optimum Branchings.”
什么使得问题可行: Cobham 在《函数的内在计算难度》一书中明确探讨了什么算法才算“高效”。同样,Edmonds 在《路径、树木和花朵》一书中解释了为什么解决一个难题至关重要,并通过对这一特定解决方案的论证,构建了一个关于优秀算法的通用框架。
what makes a problem feasible: Cobham, “The Intrinsic Computational Difficulty of Functions,” explicitly considers the question of what should be considered an “efficient” algorithm. Similarly, Edmonds, “Paths, Trees, and Flowers,” explains why a solution to a difficult problem is significant and, in making the case for this particular solution, establishes a general framework for what makes algorithms good.
该领域事实上的越界标记:事实上,有些算法的运行速度比多项式时间慢,但比指数时间快;这些“超多项式”运行时间也将它们置于高效算法集之外。
the field’s de facto out-of-bounds marker: There are, in fact, algorithms that run slower than polynomial time but faster than exponential time; these “superpolynomial” runtimes also put them outside the set of efficient algorithms.
要么有效解决,要么无效:计算机科学中可有效解决的问题集称为P,即“多项式时间”的缩写。同时,有争议的极限问题集称为NP,即“非确定性多项式”。NP 中的问题一旦找到就可以有效地验证其解决方案,但是否每个可以轻松验证的问题都可以轻松解决仍不得而知。例如,如果有人向您展示一条路线并说它少于 1,000 英里,则该说法很容易验证 - 但找到一条少于 1,000 英里的路线,或证明它是不可能的,则完全是另一回事。P = NP的问题(即,是否有可能有效地跳转到NP问题的解)是计算机科学中最大的未解之谜。
either efficiently solvable or not: The set of efficiently solvable problems in computer science is called P, short for “polynomial time.” The controversially liminal set of problems, meanwhile, is known as NP, for “nondeterministic polynomial.” Problems in NP can have their solutions verified efficiently once found, but whether every problem that can be easily verified can also be easily solved is unknown. For instance, if someone shows you a route and says that it’s less than 1,000 miles, the claim is easy to check—but finding a route less than 1,000 miles, or proving that it’s impossible, is another feat entirely. The question of whether P = NP (i.e., whether it’s possible to jump efficiently to the solutions of NP problems) is the greatest unsolved mystery in computer science.
解决方案的主要进展是证明某些问题具有特殊地位:如果其中一个问题可以有效解决,那么NP中的任何问题都可以有效解决,并且P = NP(Cook,“定理证明程序的复杂性”)。这些问题被称为“ NP难”问题。由于没有关于P是否= NP的答案,因此NP中的问题无法有效解决,这就是我们称其为“棘手”的原因。(在“术语提案”中,Donald Knuth 建议将此作为NP难问题的适当标签,此外还为任何可以证明P = NP的人提供一只活火鸡。)Eugene Lawler 在第 5 章中遇到的棘手调度问题就属于此类。本身属于NP的NP难问题被称为“ NP完全”。请参阅 Karp 的《组合问题的可约性》,其中经典结果表明旅行商问题的一个版本是NP完全的,以及 Fortnow 的《金票:P、NP 和对不可能的探索》 ,其中对P和NP进行了通俗易懂的介绍。
The main advance toward a solution has been the demonstration that there are certain problems with a special status: if one of them can be solved efficiently, then any problem in NP can be solved efficiently and P = NP (Cook, “The Complexity of Theorem-Proving Procedures”). These are known as “NP-hard” problems. In the absence of an answer to whether P = NP, problems in NP cannot be solved efficiently, which is why we refer to them as “intractable.” (In “A Terminological Proposal,” Donald Knuth suggested this as an appropriate label for NP-hard problems, in addition to offering a live turkey to anybody who could prove P = NP.) The intractable scheduling problems that Eugene Lawler encountered in chapter 5 fall into this category. An NP-hard problem that is itself in NP is known as “NP-complete.” See Karp, “Reducibility Among Combinatorial Problems,” for the classic result showing that a version of the traveling salesman problem is NP-complete, and Fortnow, The Golden Ticket: P, NP, and the Search for the Impossible, for an accessible introduction to P and NP.
大多数计算机科学家认为 不存在 这样的问题:在2002年对100位顶尖理论计算机科学家的调查中,61位认为P ≠ NP,只有9位认为P = NP(Gasarch,“ P = NP ”调查)。虽然证明P = NP可以通过展示NP完全问题的多项式时间算法来实现,但证明P ≠ NP需要对多项式时间算法的极限进行复杂的论证,而且受访者对于解决这个问题究竟需要什么样的数学知识并没有达成共识。但大约有一半的人认为这个问题将在2060年之前得到解决。
most computer scientists believe that there aren’t any: In a 2002 survey of one hundred leading theoretical computer scientists, sixty-one thought P ≠ NP and only nine thought P = NP (Gasarch, “The P =? NP Poll”). While proving P = NP could be done by exhibiting a polynomial-time algorithm for an NP-complete problem, proving P ≠ NP requires making complex arguments about the limits of polynomial-time algorithms, and there wasn’t much agreement among the people surveyed about exactly what kind of mathematics will be needed to solve this problem. But about half of them did think the issue would be resolved before 2060.
此外,还有许多其他优化问题:这包括顶点覆盖和集合覆盖的版本——Karp 在《组合问题的可约性》中将这两个问题确定为NP,其中有 21 个问题被证明属于这一类。到 20 世纪 70 年代末,计算机科学家已经确定了大约三百个 NP完全问题(Garey 和 Johnson,《计算机与难解性》 ),从那时起,这个名单就显著增加了。其中包括一些人类非常熟悉的问题。2003 年,数独被证明是NP完全的(Yato 和 Seta,《复杂性和完整性》),最大化俄罗斯方块中清除行数也是 NP 完全的,即使对未来棋子有完美的了解(Demaine、Hohenberger 和 Liben-Nowell,《俄罗斯方块很难,甚至难以近似》)。 2012 年,确定《超级马里奥兄弟》等平台游戏中是否存在通关路径被正式添加到列表中(Aloupis、Demaine 和 Guo,“经典任天堂游戏是(NP-)难”)。
What’s more, many other optimization problems: This includes versions of vertex cover and set cover—two problems identified as belonging to NP in Karp, “Reducibility Among Combinatorial Problems,” where twenty-one problems were famously shown to be in this set. By the end of the 1970s, computer scientists had identified some three hundred NP-complete problems (Garey and Johnson, Computers and Intractability), and the list has grown significantly since then. These include some problems that are very familiar to humans. In 2003, Sudoku was shown to be NP-complete (Yato and Seta, “Complexity and Completeness”), as was maximizing the number of cleared rows in Tetris, even with perfect knowledge of future pieces (Demaine, Hohenberger, and Liben-Nowell, “Tetris Is Hard, Even to Approximate”). In 2012, determining whether there exists a path to the end of the level in platformer games like Super Mario Brothers was officially added to the list (Aloupis, Demaine, and Guo, “Classic Nintendo Games are (NP-) Hard”).
“你仍然必须与之抗争”: Jan Karel Lenstra,个人访谈,2014 年 9 月 2 日。
“you still have to fight it”: Jan Karel Lenstra, personal interview, September 2, 2014.
“完美是善的敌人”:伏尔泰的对句Dans ses écrits, un sage Italien / Dit que le mieux est l'ennemi du bien(“一位意大利圣人在他的著作中/说完美是善的敌人”)出现在他的诗《La Bégueule》的开头。伏尔泰早些时候在他 1764 年的哲学词典中引用了意大利语“Le meglio è l'inimico del bene”。
“The perfect is the enemy of the good”: Voltaire’s couplet Dans ses écrits, un sage Italien / Dit que le mieux est l’ennemi du bien (“In his writings, an Italian sage / Says the perfect is the enemy of the good”) appears at the start of his poem “La Bégueule.” Voltaire had earlier cited the Italian expression “Le meglio è l’inimico del bene” in his 1764 Dictionnaire philosophique.
他们的思想也转向放松: Shaw,《放松方法简介》;Henderson,《离散放松技巧》。读者须知:本书数学内容过于密集,阅读起来远非轻松。
their minds also turn to relaxation: Shaw, An Introduction to Relaxation Methods; Henderson, Discrete Relaxation Techniques. Caveat lector: the math is intense enough that these make for far-from-relaxing reading.
林肯司法巡回区:林肯司法巡回区的城镇地图源自《亚伯拉罕·林肯协会期刊》中1847-1853年第八司法巡回区的地图。请参阅http://quod.lib.u mich.edu/j/jala/images/fraker_fig01a.jpg。
for Lincoln’s judicial circuit: The towns of Lincoln’s judicial circuit are derived from the 1847–1853 map of the 8th Judicial Circuit in the Journal of the Abraham Lincoln Association. See http://quod.lib.u mich.edu/j/jala/images/fraker_fig01a.jpg.
基本上没有时间:好吧,确实需要一点时间——如果幸运的话,时间与城市数量成线性关系;如果不幸,时间与城市数量成线性关系。Pettie 和 Ramachandran,《最优最小生成树算法》。
essentially no time at all: Well, okay, a little bit of time—linear in the number of cities if you’re lucky, linearithmic if you’re not. Pettie and Ramachandran, “An Optimal Minimum Spanning Tree Algorithm.”
生成树及其自由回溯:通过最小生成树解决旅行商问题在 Christofides 的《新启发式的最坏情况分析》中进行了讨论。
the spanning tree, with its free backtracking: Approaching the traveling salesman problem via the minimum spanning tree is discussed in Christofides, Worst-Case Analysis of a New Heuristic.
走遍地球上的每一个城镇:想了解更多关于世界各城市旅行商问题(即所谓的“世界旅行商问题”)的最新进展,可以访问http://www.math.uwaterloo.ca/tsp/world/查阅最新报告。想了解更多关于旅行商问题的一般信息,Cook 的《追寻旅行商》是一本不错的参考书,而 Lawler 等人的《旅行商问题》则可以满足那些想要深入了解的人的需求。
visits every single town on Earth: For more on the state of the art in the all-world-cities traveling salesman problem (the so-called “World TSP”), an up-to-date report can be found at http://www.math.uwaterloo.ca/tsp/world/. For more on the traveling salesman problem in general, Cook, In Pursuit of the Traveling Salesman, is a good general reference, and Lawler et al., The Traveling Salesman Problem, will satisfy those who want to go deeper.
寻找最小位置集:这个经典的离散优化问题被称为“集合覆盖”问题。
finding the minimal set of locations: This classic discrete optimization problem is known as the “set cover” problem.
“当你连一半都做不了的时候”:劳拉·艾伯特·麦克莱,个人采访,2014 年 9 月 16 日。
“when you can’t do half of this”: Laura Albert McLay, personal interview, September 16, 2014.
让你舔最少的信封:在计算机科学中,这被称为“顶点覆盖”问题。它类似于集合覆盖问题,其目标不是寻找覆盖所有人的消防站的最小数量,而是找到与其他所有人有联系的人数最少的人数。
let you lick the fewest envelopes: In computer science, this is known as the “vertex cover” problem. It’s a kind of cousin to the set cover problem, where instead of seeking the smallest number of fire stations whose coverage includes everyone, the goal is to find the smallest number of people who are connected to everyone else.
解决这些问题的 连续 版本:某些类型的连续优化问题可以在多项式时间内求解;最突出的例子是线性规划问题,其中待优化的指标和解的约束都可以表示为所涉及变量的线性函数。参见 Khachiyan 的《线性规划中的多项式算法》和 Karmarkar 的《线性规划的一种新的多项式时间算法》。然而,连续优化并非万能药:也存在一些难以解决的连续优化问题。例如,参见 Pardalos 和 Schnitger 的《检查约束二次规划中的局部最优性是NP难的》。
solving the continuous versions of these problems: There are certain kinds of continuous optimization problems that can be solved in polynomial time; the most prominent example is linear programming problems, in which both the metric to be optimized and the constraints on the solution can be expressed as a linear function of the variables involved. See Khachiyan, “Polynomial Algorithms in Linear Programming,” and Karmarkar, “A New Polynomial-Time Algorithm for Linear Programming.” However, continuous optimization is no panacea: there are also classes of continuous optimization problems that are intractable. For example, see Pardalos and Schnitger, “Checking Local Optimality in Constrained Quadratic Programming is NP-hard.”
最多两倍的邀请: Khot 和 Regev,“顶点覆盖可能很难近似到 2- ε以内。”
at most twice as many invitations: Khot and Regev, “Vertex Cover Might Be Hard to Approximate to Within 2-ε.”
很快让我们进入一个舒适的范围:有关这些近似值的更多信息,请参阅 Vazirani 的《近似算法》。
quickly get us within a comfortable bound: For more on these approximations, see Vazirani, Approximation Algorithms.
并非灵丹妙药:连续松弛是否能为最小顶点覆盖(派对邀请)问题提供最佳近似值,或者是否可以找到更好的近似值,这在该领域仍然是一个悬而未决的问题。
not a magic bullet: It’s still an open question within the field whether Continuous Relaxation even offers the best possible approximation for the minimum vertex cover (party invitations) problem, or whether better approximations can be found.
“难以置信!”: 《公主新娘》,剧本由威廉·戈德曼撰写;二十世纪福克斯,1987 年。
“Inconceivable!”: The Princess Bride, screenplay by William Goldman; 20th Century Fox, 1987.
称为拉格朗日松弛的计算技术:拉格朗日松弛(最初拼写为“Lagrangean”)由加州大学洛杉矶分校的 Arthur M. Geoffrion 在“整数规划的拉格朗日松弛”中命名。该思想本身被认为出现于 1970 年 Michael Held(IBM 员工)和 Richard Karp(加州大学伯克利分校员工)关于旅行商问题的著作中 - 参见 Held 和 Karp 的“旅行商问题和最小生成树”以及 Held 和 Karp 的“旅行商问题和最小生成树:第二部分”。然而,也存在更早的前身 - 例如,Lorie 和 Savage 的“配给资本中的三个问题”;Everett III 的“广义拉格朗日乘数法”;以及 Gilmore 和 Gomory 的“解决下料问题的线性规划方法,第二部分”。有关概述和思考,请参阅 Fisher 的“解决整数规划问题的拉格朗日松弛法”以及 Geoffrion 的“整数规划的拉格朗日松弛法”。
computational technique called Lagrangian Relaxation: Lagrangian Relaxation (initially spelled “Lagrangean”) was given its name by Arthur M. Geoffrion of UCLA in “Lagrangean Relaxation for Integer Programming.” The idea itself is considered to have emerged in the work of Michael Held (of IBM) and Richard Karp (of UC Berkeley) on the traveling salesman problem in 1970—see Held and Karp, “The Traveling-Salesman Problem and Minimum Spanning Trees,” and Held and Karp, “The Traveling-Salesman Problem and Minimum Spanning Trees: Part II.” Earlier precursors, however, also exist—for instance, Lorie and Savage, “Three Problems in Rationing Capital”; Everett III, “Generalized Lagrange Multiplier Method”; and Gilmore and Gomory, “A Linear Programming Approach to the Cutting Stock Problem, Part II.” For an overview and reflections see Fisher, “The Lagrangian Relaxation Method for Solving Integer Programming Problems,” as well as Geoffrion, “Lagrangian Relaxation for Integer Programming.”
“如果你最终得到分数游戏”:迈克尔·特里克,个人访谈,2013 年 11 月 26 日。
“If you end up with fractional games”: Michael Trick, personal interview, November 26, 2013.
“虚构永远无法调和”:克里斯托弗·布克,《当风能或欧盟等伟大幻想与现实相冲突时会发生什么?》,《每日电讯报》,2011 年 4 月 9 日。
“make-believe can never be reconciled”: Christopher Booker, “What Happens When the Great Fantasies, Like Wind Power or European Union, Collide with Reality?,” the Telegraph, April 9, 2011.
9.随机性
9. RANDOMNESS
“为什么以及如何绝对是个谜”:引自莎莎和拉宾的《对迈克尔·拉宾的采访》。
“why and how is absolutely mysterious”: Quoted in Shasha and Rabin, “An Interview with Michael Rabin.”
随机算法的用途: Motwani 和 Raghavan 合著的《随机算法》以及 Mitzenmacher 和 Upfal 合著的《概率与计算》详细讨论了随机算法。Karp 的《随机算法简介》和 Motwani 和 Raghavan 的《随机算法》提供了更短但更古老的介绍。
a randomized algorithm uses: Randomized algorithms are discussed in detail in Motwani and Raghavan, Randomized Algorithms, and Mitzenmacher and Upfal, Probability and Computing. Shorter but older introductions are provided by Karp, “An Introduction to Randomized Algorithms,” and Motwani and Raghavan, “Randomized Algorithms.”
一个有趣的概率分析:布冯,“Essai d'arithmétique Morale”。
an interesting probabilistic analysis: Buffon, “Essai d’arithmétique morale.”
只需将针落到纸上即可:拉普拉斯,概率分析理论。
simply by dropping needles onto paper: Laplace, Théorie analytique des probabilités.
拉扎里尼据称投掷了 3,408 次:拉扎里尼,“Un'applicazione del calcolo della probabilità”。
Lazzarini supposedly made 3,408 tosses: Lazzarini, “Un’applicazione del calcolo della probabilità.”
使得 Lazzarini 的报告看起来可疑:有关 Lazzarini 结果的进一步讨论,请参阅 Gridgeman 的“几何概率和数字π ”和 Badger 的“Lazzarini 对π的幸运近似值”。
makes Lazzarini’s report seem suspicious: For further discussion of Lazzarini’s results, see Gridgeman, “Geometric Probability and the Number π,” and Badger, “Lazzarini’s Lucky Approximation of π.”
他患上了脑炎:乌拉姆的故事出现在《乌拉姆:一位数学家的冒险》一书中。
he had contracted encephalitis: Ulam’s story appears in Ulam, Adventures of a Mathematician.
“一流智慧的考验”:菲茨杰拉德,《崩溃》。后来与其他文章一起收录在《崩溃》中。
“the test of a first-rate intelligence”: Fitzgerald, “The Crack-Up.” Later collected with other essays in The Crack-Up.
“它可能更加实用”:乌拉姆,《数学家的冒险》,第196-197页。计算克朗代克纸牌游戏的获胜概率至今仍是一个活跃的研究领域,主要由蒙特卡洛模拟推动。有关该领域近期研究的示例,请参阅Bjarnason、Fern和Tadepalli合著的《使用蒙特卡洛规划对克朗代克纸牌游戏进行下界》。
“it may be much more practical”: Ulam, Adventures of a Mathematician, pp. 196–197. Calculating the winning odds for Klondike solitaire remains an active area of research to this day, driven chiefly by Monte Carlo simulation. For an example of recent work in the area, see Bjarnason, Fern, and Tadepalli, “Lower Bounding Klondike Solitaire with Monte-Carlo Planning.”
Metropolis 为这种方法命名: Metropolis 在 Hurd 的一封信中声称拥有命名权,“早期蒙特卡罗计算注释”。
Metropolis named this approach: Metropolis claims the naming rights in a letter that appears in Hurd, “Note on Early Monte Carlo Computations.”
拉比世家的后裔:沙沙 (Shasha) 和拉泽尔 (Lazere),疯了。
descendant of a long line of rabbis: Shasha and Lazere, Out of Their Minds.
它可能遵循多种路径:拉宾与达纳·斯科特合作撰写的关键论文是“有限自动机及其决策问题”。在第 8 章讨论旅行商问题的复杂性类别时,我们已经遇到了这个概念成为理论计算机科学核心的方式之一;拉宾的“非确定性”计算概念是NP中的“ N ” 。
multiple paths it might follow: Rabin’s key paper here, coauthored with Dana Scott, was “Finite Automata and Their Decision Problems.” We’ve already encountered one of the ways that this concept became central to theoretical computer science in our discussion of the complexity class of the traveling salesman problem in chapter 8; Rabin’s notion of “nondeterministic” computing is the “N” of NP.
“最明显无用的分支之一”:这句话出自哈代的《素数》;另见哈代全集。关于素数在密码学中的影响,请参阅施奈尔的《应用密码学》。
“one of the most obviously useless branches”: The quote is from Hardy, “Prime Numbers”; see also Hardy, Collected Works. For more about the influence of prime numbers in cryptography, see, e.g., Schneier, Applied Cryptography.
例如,在现代加密技术中,一种广泛使用的基于素数乘法的算法是RSA,它代表了其发明者Ron Rivest、Adi Shamir和Leonard Adleman的首字母。参见Rivest、Shamir和Adleman合著的《一种获取数字签名和公钥密码系统的方法》。其他密码系统,例如Diffie-Hellman,也使用素数;参见Diffie和Hellman合著的《密码学的新方向》。
In modern encryption, for instance: One widely used algorithm that is based on the multiplication of prime numbers is RSA, which stands for the initials of its inventors: Ron Rivest, Adi Shamir, and Leonard Adleman. See Rivest, Shamir, and Adleman, “A Method for Obtaining Digital Signatures and Public-Key Cryptosystems.” Other cryptographic systems—e.g., Diffie-Hellman—also use prime numbers; see Diffie and Hellman, “New Directions in Cryptography.”
然而,问题在于误报:米勒方法的突破点(或者说缺乏突破点)取决于这些误报被忽略的难易程度。为了确定给定数字n的值,需要检查多少个x值?米勒证明,如果“广义黎曼假设”成立,则需要检查的潜在证人数量最少为O ((log n ) ² )——远少于埃拉斯托尼筛法等算法所需的数量。但问题在于:广义黎曼假设过去——现在——仍未得到证实。
The problem, though, is false positives: The possible breakthrough—or lack thereof—in Miller’s approach would come down to how easily these false positives could be dismissed. How many values of x do you need to check to be sure about a given number n? Miller showed that if the “generalized Riemann hypothesis” were true, the minimum number of potential witnesses that would need to be checked is O((log n)2)—far less than the required by algorithms like the Sieve of Erastothenes. But here was the hitch: the generalized Riemann hypothesis was—and still is—unproven.
(黎曼猜想由德国数学家伯恩哈德·黎曼于 1859 年首次提出,它涉及一个称为黎曼 zeta 函数的复杂数学函数的性质。该函数与素数的分布密切相关,特别是与这些数在数轴上出现的规律有关。如果该猜想成立,那么素数的行为足够好,可以保证米勒算法的效率。但没有人知道它是否成立。事实上,黎曼猜想是数学中六个主要未解决的问题之一,克莱数学研究所将为其解答颁发 100 万美元的“千禧年奖金”。我们在第 8 章中看到的P = NP是否成立的问题也是一个千禧年奖金问题。)
(The Riemann hypothesis, first offered by the German mathematician Bernhard Riemann in 1859, concerns the properties of a complex mathematical function called the Riemann zeta function. This function is intimately related to the distribution of prime numbers, and in particular how regularly those numbers appear on the number line. If the hypothesis is true, then primes are well enough behaved as to guarantee the efficiency of Miller’s algorithm. But nobody knows if it’s true. In fact, the Riemann hypothesis is one of six major open problems in mathematics for whose solutions the Clay Mathematics Institute will award a “Millennium Prize” of $1 million. The question of whether P = NP, which we saw in chapter 8, is also a Millennium Prize problem.)
“迈克尔,这是沃恩”:拉宾在《莎莎和拉泽尔,疯狂的》中讲述了这个故事。
“Michael, this is Vaughan”: Rabin tells this story in Shasha and Lazere, Out of Their Minds.
甚至可以快速识别巨大的素数:拉宾关于素数性测试的论文《素数性测试的概率算法》几年后发表。与此同时,罗伯特·索洛维(Robert Solovay)和沃尔克·施特拉森(Volker Strassen)也开发了一种类似的概率算法,该算法基于素数性测试需要遵循的另一组方程,尽管他们的算法效率较低;参见索洛维和施特拉森的《素数性快速蒙特卡罗测试》。
quickly identify even gigantic prime numbers: Rabin’s paper on his primality test, “Probabilistic Algorithm for Testing Primality,” appeared a few years later. In parallel, Robert Solovay and Volker Strassen had developed a similar probabilistic algorithm based on a different set of equations that primes need to obey, although their algorithm was less efficient; see Solovay and Strassen, “A Fast Monte-Carlo Test for Primality.”
小于百万亿亿分之一: OpenSSL 的文档指定了一个函数来“执行 Miller-Rabin 概率素数测试……使用的迭代次数……对于随机输入产生的误报率最多为 2 − 80 ”;请参阅https://www.openssl.org/docs/crypto/BN_generate_prime.html。同样,美国联邦信息处理标准 (FIPS) 规定其数字签名标准 (DSS) 接受 2 − 80的错误概率(至少对于 1,024 位密钥);请参阅 Gallagher 和 Kerry 的《数字签名标准》。四十次 Miller-Rabin 测试足以达到这个界限,而 1990 年代的研究表明,在许多情况下只需三次 Miller-Rabin 测试就足够了。请参阅 Damgård、Landrock 和 Pomerance 的《强概率素数测试的平均情况错误估计》; Burthe Jr.,“使用强概率素数检验的进一步调查”;以及 Menezes、Van Oorschot 和 Vanstone 合著的《应用密码学手册》,以及http://security.stackexchange.com/questions/4544/how-many-iterations-of-rabin-miller-should-be-used-to-generate-cryptographic-saf上的最新讨论。
less than one in a million billion billion: The documentation for OpenSSL specifies a function to “perform a Miller-Rabin probabilistic primality test with … a number of iterations used … that yields a false positive rate of at most 2−80 for random input”; see https://www.openssl.org/docs/crypto/BN_generate_prime.html. Likewise the US Federal Information Processing Standard (FIPS) specifies that its Digital Signature Standard (DSS) accept error probability of 2−80 (for 1,024-bit keys, at least); see Gallagher and Kerry, Digital Signature Standard. Forty Miller-Rabin tests are sufficient to achieve this bound, and work from the 1990s has suggested that in many cases as few as three Miller-Rabin tests will suffice. See Damgård, Landrock, and Pomerance, “Average Case Error Estimates for the Strong Probable Prime Test”; Burthe Jr., “Further Investigations with the Strong Probable Prime Test”; and Menezes, Van Oorschot, and Vanstone, Handbook of Applied Cryptography, as well as more recent discussion at http://security.stackexchange.com/questions/4544/how-many-iterations-of-rabin-miller-should-be-used-to-generate-cryptographic-saf.
沙粒的数量:根据各种来源的估计,地球上沙粒的数量在 10 18到 10 24之间。
for the number of grains of sand: The number of grains of sand on Earth is estimated from various sources at between 1018 and 1024.
是否存在一种有效的算法:这里的“有效”我们使用该领域的标准定义,即“多项式时间”,如第 8 章所述。
whether there would ever be an efficient algorithm: Here by “efficient” we are using the field’s standard definition, which is “polynomial-time,” as discussed in chapter 8.
其中一种方法确实被发现了: Agrawal、Kayal 和 Saxena,“PRIMES Is in P ”。
one such method did get discovered: Agrawal, Kayal, and Saxena, “PRIMES Is in P.”
生成一些随机的 xs 并将它们代入:关于随机性在多项式恒等式测试中的作用的关键结果之一是所谓的“Schwartz-Zippel引理”。参见 Schwartz 的“用于验证多项式恒等式的快速概率算法”;Zippel 的“用于稀疏多项式的概率算法”;以及 DeMillo 和 Lipton 的“关于代数程序测试的概率评论”。
generate some random xs and plug them in: One of the key results on the role of randomness in polynomial identity testing is what’s called the “Schwartz–Zippel lemma.” See Schwartz, “Fast Probabilistic Algorithms for Verification of Polynomial Identities”; Zippel, “Probabilistic Algorithms for Sparse Polynomials”; and DeMillo and Lipton, “A Probabilistic Remark on Algebraic Program Testing.”
我们唯一可行的问题是:我们能否找到一个高效的确定性算法来处理多项式恒等式检验?更广泛地说,我们找到好的随机算法的地方,是否也必然存在一个高效的确定性算法?或者,是否存在一些随机算法可以有效解决,但确定性算法却无法解决的问题?这是理论计算机科学中一个有趣的问题,其答案至今仍不得而知。
the only practical one we have: Will an efficient deterministic algorithm for polynomial identity testing ever be found? More broadly, does an efficient deterministic algorithm have to exist anyplace we find a good randomized one? Or could there be problems that randomized algorithms can solve efficiently but that deterministic algorithms simply cannot? It is an interesting problem in theoretical computer science, and the asnwer to it is still unknown.
用于探索随机化算法和确定性算法之间关系的方法之一被称为去随机化——本质上就是采用随机算法并去除其中的随机性。实际上,计算机很难获得真正的随机性——因此,当人们实现随机化算法时,他们通常使用确定性过程来生成遵循真随机性某些统计特性的数字。去随机化明确了这一点,研究当随机算法中的随机性被其他复杂计算过程的输出取代时会发生什么。
One of the approaches that has been used to explore the relationship between randomized and deterministic algorithms is called derandomization—essentially, taking randomized algorithms and removing the randomness from them. In practice, it’s hard for a computer to get access to true randomness—so when people implement a randomized algorithm, they often use a deterministic procedure to generate numbers that obey certain statistical properties of true randomness. Derandomization makes this explicit, examining what happens when the randomness in randomized algorithms is replaced by the output of some other complex computational process.
去随机化的研究表明,将高效的随机算法转化为高效的确定性算法是可能的——前提是你能找到一个函数,它足够复杂,使其输出看起来随机,但又足够简单,以便能够高效计算。有关(详细)信息,请参阅 Impagliazzo 和 Wigderson 的“如果E需要指数电路,则P = BPP ”以及 Impagliazzo 和 Wigderson 的“随机性与时间”。
The study of derandomization shows that it’s possible to turn efficient randomized algorithms into efficient deterministic algorithms—provided you can find a function that is sufficiently complex that its output looks random but sufficiently simple that it can be computed efficiently. For (detailed) details, see Impagliazzo and Wigderson, “P = BPP if E Requires Exponential Circuits,” and Impagliazzo and Wigderson, “Randomness vs. Time.”
他称之为“无知之幕”:无知之幕是在罗尔斯的《正义论》中引入的。
he called the “veil of ignorance”: The veil of ignorance is introduced in Rawls, A Theory of Justice.
罗尔斯的哲学批评者:罗尔斯批评者中最突出的是经济学家约翰·哈萨尼;例如,参见哈萨尼的“马克西姆最小原则能作为道德的基础吗?对约翰·罗尔斯理论的批判”。
Rawls’s philosophical critics: Most prominent among Rawls’s critics was economist John Harsanyi; see, e.g., Harsanyi, “Can the Maximin Principle Serve as a Basis for Morality? A Critique of John Rawls’s Theory.”
奥梅拉斯文明:勒奎恩,《离开奥梅拉斯的人》。
the civilization of Omelas: Le Guin, “The Ones Who Walk Away from Omelas.”
这些都是值得批评的:有关有时被称为“令人厌恶的结论”的更多信息,请参阅帕菲特的《理由与人》 ,以及阿伦尼乌斯的《人口价值论中的不可能性定理》。
These are worthy critiques: For more on what is sometimes called “the repugnant conclusion,” see Parfit, Reasons and Persons, as well as, for instance, Arrhenius, “An Impossibility Theorem in Population Axiology.”
“工程师而非哲学家的关注点”: Aaronson,“为什么哲学家应该关心计算复杂性。”
“concern of engineers rather than philosophers”: Aaronson, “Why Philosophers Should Care About Computational Complexity.”
“注意到了一些你不常看到的东西 ” :丽贝卡·兰格,《为什么故事这么少?》,GiveDirectly 博客,2014 年 11 月 12 日,https://www.givedirectly.org/blog-post.html? id=2288694352161893466 。
“noticed something you don’t often see”: Rebecca Lange, “Why So Few Stories?,” GiveDirectly blog, November 12, 2014, https://www.givedirectly.org/blog-post.html?id=2288694352161893466.
“我的意思是消极能力”:约翰·济慈,1817 年 12 月 21 日写给乔治和托马斯·济慈的信。
“I mean Negative Capability”: John Keats, letter to George and Thomas Keats, December 21, 1817.
“对人类生活目的的充分保证”:约翰·斯图尔特·密尔,《论自由》(1859 年)。
“assurance sufficient for the purposes of human life”: John Stuart Mill, On Liberty (1859).
“应该有个喝酒游戏”:迈克尔·米岑马赫,个人访谈。2013年11月22日。
“there should be a drinking game”: Michael Mitzenmacher, personal interview. November 22, 2013.
超过一万亿个不同的 URL: “我们知道网络很大...”2008 年 7 月 25 日,http://googleblog.blogspot.com/2008/07/we-knew-web-was-big.html。
well over a trillion distinct URLs: “We Knew the Web Was Big…” July 25, 2008, http://googleblog.blogspot.com/2008/07/we-knew-web-was-big.html.
大约有七十七个字符: Kelvin Tan,“URL 的平均长度(第 2 部分)”,2010 年 8 月 16 日,http://www.supermind.org/blog/740/average-length-of-a-url-part-2。
weighs in at about seventy-seven characters: Kelvin Tan, “Average Length of a URL (Part 2),” August 16, 2010, http://www.supermind.org/blog/740/average-length-of-a-url-part-2.
URL 被输入到一组方程式中: Bloom,“具有允许错误的哈希编码中的空间/时间权衡”。
the URL is entered into a set of equations: Bloom, “Space/Time Trade-offs in Hash Coding with Allowable Errors.”
许多最新的网络浏览器都附带了该功能: Google Chrome 至少在 2012 年之前都使用了布隆过滤器:请参阅http://blog.alexyakunin.com/2010/03/nice-bloom-filter-application.html和https://chromiumcodereview.appspot.com/10896048/。
shipped with a number of recent web browsers: Google Chrome until at least 2012 used a Bloom filter: see http://blog.alexyakunin.com/2010/03/nice-bloom-filter-application.html and https://chromiumcodereview.appspot.com/10896048/.
比特币等加密货币的一部分: Gavin Andresen,“核心开发状态报告#1”,2012 年 11 月 1 日,https://bitcoinfoundation.org/2012/11/core-development-status-report-1/。
part of cryptocurrencies like Bitcoin: Gavin Andresen, “Core Development Status Report #1,” November 1, 2012, https://bitcoinfoundation.org/2012/11/core-development-status-report-1/.
“河流蜿蜒”:理查德·肯尼,《水文学;泪水》,载于《一股河:诗歌,1994-2007》(纽约:克诺夫出版社,2008 年)。
“The river meanders”: Richard Kenney, “Hydrology; Lachrymation,” in The One-Strand River: Poems, 1994–2007 (New York: Knopf, 2008).
尝试破译密码时使用此方法:参见 Berg-Kirkpatrick 和 Klein 的“通过一百万次随机重启进行破译”。
use this approach when trying to decipher codes: See Berg-Kirkpatrick and Klein, “Decipherment with a Million Random Restarts.”
称为 Metropolis 算法:有时也称为 Metropolis-Hastings 算法,该技术在 Metropolis 等人的“快速计算机器的状态方程计算”和 Hastings 的“使用马尔可夫链的蒙特卡罗方法及其应用”中进行了描述。Metropolis 算法是由 Nicholas Metropolis 和两对夫妻团队 Marshall 和 Arianna Rosenbluth 以及 Edward 和 Augusta Teller 在 20 世纪 50 年代开发的。Metropolis 是描述该算法的论文的第一作者,因此今天它被称为 Metropolis 算法——具有双重讽刺意味。首先,Metropolis 似乎对算法的开发贡献不大,作为计算实验室的负责人,他被列为作者只是出于礼貌(参见 Rosenbluth,Marshall Rosenbluth,接受 Kai-Henrik Barth 的采访)。更重要的是,大都会本人喜欢给事物起说明性的名字:他声称自己命名了化学元素锝和砹,以及 MANIAC 计算机和蒙特卡罗技术本身(赫德,“早期蒙特卡罗计算注释”)。
called the Metropolis Algorithm: Sometimes also known as the Metropolis-Hastings Algorithm, this technique is described in Metropolis et al., “Equation of State Calculations by Fast Computing Machines,” and Hastings, “Monte Carlo Methods Using Markov Chains and Their Applications.” The Metropolis Algorithm was developed by Nicholas Metropolis and the two husband-and-wife teams of Marshall and Arianna Rosenbluth and Edward and Augusta Teller in the 1950s. Metropolis was the first author on the paper describing the algorithm, so today it is known as the Metropolis Algorithm—which is doubly ironic. For one thing, Metropolis apparently made little contribution to the development of the algorithm, being listed as an author out of courtesy, as the head of the computing laboratory (see Rosenbluth, Marshall Rosenbluth, Interviewed by Kai-Henrik Barth). What’s more, Metropolis himself liked giving things illustrative names: he claimed to have named the chemical elements technetium and astatine, as well as the MANIAC computer and the Monte Carlo technique itself (Hurd, “Note on Early Monte Carlo Computations”).
“从熔体中生长单晶”: Kirkpatrick、Gelatt 和 Vecchi,“通过模拟退火进行优化”。
“Growing a single crystal from a melt”: Kirkpatrick, Gelatt, and Vecchi, “Optimization by Simulated Annealing.”
“IBM 最优秀的人”:斯科特·柯克帕特里克,个人访谈,2014 年 9 月 2 日。
“The guy who was the best at IBM”: Scott Kirkpatrick, personal interview, September 2, 2014.
最后,我们开始 只走 上坡路:如果这个想法——一开始愿意在各种选项之间摇摆不定,然后更专注于好的选项——听起来很熟悉,那确实如此:优化一个复杂函数需要面对探索/利用的权衡。事实证明,随机性是解决多臂老虎机等问题以及柯克帕特里克所关注的优化问题的一种相当不错的策略来源。
Finally we’d start going only uphill: If this idea—starting out being willing to move around between options, then focusing more tightly on the good ones—sounds familiar, it should: optimizing a complex function requires facing the explore/exploit tradeoff. And randomness turns out to be a source of pretty good strategies for solving problems like multi-armed bandits as well as the kind of optimization problems that Kirkpatrick was focused on.
如果你还记得,多臂老虎机提供了几种不同的选择——我们可以拉动的臂——它们会带来不同的、未知的收益。挑战在于如何在尝试新选择(探索)和追求迄今为止找到的最佳选择(利用)之间找到平衡。最好在早期保持乐观和探索性,之后则变得更加敏锐和利用性。这种逐渐降低对替代方案的乐观程度的策略,有望带来你能期待的最好结果——后悔的累积速度越来越慢,而你的总后悔程度则随着时间呈对数函数增长。
If you recall, the multi-armed bandit offers us several different options—arms we can pull—that provide different, unknown payoffs. The challenge is to find the balance between trying new options (exploring) and pursuing the best option found so far (exploiting). Being more optimistic and more exploratory early on is best, becoming more discerning and exploiting more later. Pursuing such a strategy of gradually decreasing optimism about the alternatives promises the best outcome you can hope for—accumulating regrets at a decreasing rate, with your total regret rising as a logarithmic function of time.
随机性提供了一种替代乐观主义的策略。直观地说,如果问题在于平衡探索和利用,为什么不直接明确地做到这一点呢?花一些时间探索,花一些时间利用。这正是多臂老虎机专家所说的Epsilon Greedy策略。
Randomness provides an alternative strategy to optimism. Intuitively, if the problem is one of balancing exploration and exploitation, why not simply do so explicitly? Spend some amount of your time exploring and some amount exploiting. And that’s exactly the strategy that multi-armed bandit experts call Epsilon Greedy.
Epsilon Greedy 包含两个部分——Epsilon 和 Greedy。Epsilon 指的是在一小部分时间(数学家用字母 epsilon 表示小数)内,你会从选项中随机选择。Greedy 指的是在其余时间,你会选择目前为止找到的最佳选项。所以,走进餐厅,抛硬币(或者掷骰子,取决于你的 epsilon 值)来决定是否尝试新菜。如果答案是肯定的,就闭上眼睛,指着菜单。如果不是,那就享用你目前最喜欢的菜。
Epsilon Greedy has two parts—Epsilon and Greedy. The Epsilon part is that some small proportion of the time (the letter epsilon is used by mathematicians to denote a small number), you choose at random from among your options. The Greedy part is that the rest of the time you take the best option you have found so far. So walk into the restaurant and flip a coin (or roll a die, depending on your value of epsilon) to decide whether to try something new. If it says yes, close your eyes and point at the menu. If not, enjoy your current favorite.
不幸的是,多臂老虎机研究人员并不特别喜欢 Epsilon Greedy 算法。它看起来很浪费时间——即使最好的选择很快就会显现出来,你也肯定会花费一部分时间去尝试新事物。如果你遵循 Epsilon Greedy 算法,那么你的后悔感会随着你玩的次数线性增加。每次用餐时,你都有可能选择非最佳的选择,所以你的平均后悔感每次都会增加相同的量。这种线性增长比基于适当校准的乐观度的确定性算法所保证的对数后悔感要糟糕得多。
Unfortunately, multi-armed bandit researchers don’t particularly like Epsilon Greedy. It seems wasteful—you’re guaranteed to spend a proportion of your time trying new things even if the best becomes clear very quickly. If you follow Epsilon Greedy, then your regret increases linearly in the number of times you play. Each time you dine, there’s a chance that you’re going to choose something other than the best, so your average regret increases by the same amount every time. This linear growth is much worse than the logarithmic regret guaranteed by deterministic algorithms based on appropriately calibrated optimism.
但是,如果 Epsilon Greedy 的简单性很有吸引力,那么还有一个好消息。这种算法有一个简单的变体 - 我们称之为Epsilon-Over- N Greedy - 它确实可以保证对数遗憾,并且在实践中表现良好(参见 Auer、Cesa-Bianchi 和 Fischer 的“多臂老虎机问题的有限时间分析”)。诀窍是随着时间的推移减少尝试新事物的机会。第一次做出选择时,您以概率 1/1 随机选择(即总是)。如果该选项不错,那么第二次您以概率 1/2 随机选择(即抛硬币:正面选择相同的选项,反面尝试新的东西)。在第三次访问时,您应该以概率 2/3 选择最好的东西,并以概率 1/3 尝试新的东西。在第N次访问餐厅时,您以概率 1/ N随机选择,否则选择迄今为止发现的最佳选择。通过逐渐降低尝试新事物的可能性,你就找到了探索和利用之间的最佳平衡点。
But if the simplicity of Epsilon Greedy is appealing, there is good news. There’s a simple variant of this algorithm—what we are dubbing Epsilon-Over-N Greedy—that does guarantee logarithmic regret, and performs well in practice (see Auer, Cesa-Bianchi, and Fischer, “Finite-Time Analysis of the Multiarmed Bandit Problem”). The trick is to decrease the chance of trying something new over time. The first time you make a choice, you choose at random with probability 1/1 (a.k.a. always). If that option is any good, then the second time you choose at random with probability 1/2 (a.k.a. flip a coin: heads you take the same option, tails you try something new). On visit three, you should pick the best thing with probability 2/3, and try something new with probability 1/3. On the Nth visit to the restaurant, you choose at random with probability 1/N, otherwise taking the best option discovered so far. By gradually decreasing the probability of trying something new, you hit the sweet spot between exploration and exploitation.
还有另一种更复杂的多臂老虎机算法,它也利用了随机性。该算法被称为汤普森抽样,以耶鲁大学医生威廉·R·汤普森的名字命名,他于 1933 年首次提出如何在两种治疗方法之间进行选择的问题(汤普森,“论一个未知概率超过另一个的可能性”)。汤普森的解决方案很简单:使用贝叶斯规则,计算每种治疗方法都是最佳治疗方法的概率。然后以该概率选择该治疗方法。一开始你一无所知,你选择任何一种治疗方法的可能性都是相同的。随着数据的积累,你会逐渐倾向于选择其中一种,但有时你仍然会选择你不喜欢的治疗方法,并且有机会改变主意。当你越来越确定一种治疗方法更好时,你最终几乎总是会使用这种治疗方法。汤普森抽样巧妙地平衡了探索和利用,同时也保证了遗憾只会以对数形式增加(参见 Agrawal 和 Goyal,“汤普森抽样分析”)。
There’s also another, more sophisticated algorithm for playing the multi-armed bandit that likewise makes use of randomness. It’s called Thompson Sampling, named after William R. Thompson, the Yale physician who first posed the problem (back in 1933) of how to choose between two treatments (Thompson, “On the Likelihood That One Unknown Probability Exceeds Another”). Thompson’s solution was simple: using Bayes’s Rule, calculate the probability that each treatment is the best. Then choose that treatment with that probability. To begin with you know nothing, and you are equally likely to choose either treatment. As the data accumulate you come to favor one over the other, but some of the time you still choose the dispreferred treatment and have the chance to change your mind. As you become more certain that one treatment is better, you will end up almost always using that treatment. Thompson Sampling balances exploration and exploitation elegantly, and also guarantees that regret will increase only logarithmically (see Agrawal and Goyal, “Analysis of Thompson Sampling”).
与其他解决多臂老虎机问题的算法相比,汤普森抽样的优势在于其灵活性。即使问题的假设发生变化(例如,你有信息表明某个选项优于其他选项、选项之间相互依赖、选项随时间变化),汤普森的策略(即以反映你认为当前最佳选项的概率来选择选项)仍然有效。因此,我们无需在每种情况下都推导出新的算法,只需应用贝叶斯规则并利用结果即可。在现实生活中,这些贝叶斯计算可能很难(汤普森本人也需要写几页复杂的数学公式才能解决只有两个选项的问题)。但是,尝试选择最佳选项,并允许你的选择具有一定程度的随机性(该随机性会根据你的确定性进行调节),这种算法不太可能让你误入歧途。
The advantage of Thompson Sampling over other algorithms for solving multi-armed bandit problems is its flexibility. Even if the assumptions of the problem change—you have information suggesting one option is better than the others, options depend on one another, options change over time—Thompson’s strategy of pursuing options with a probability that reflects your sense that they are the best currently available still works. So rather than having to derive a new algorithm in each of these cases, we can simply apply Bayes’s Rule and use the results. In real life, those Bayesian calculations can be hard (it took Thompson himself several pages of intricate mathematics to solve the problem with just two options). But trying to choose the best option and allowing an amount of randomness to your choices that is tempered by your degree of certainty is an algorithm that is unlikely to lead you astray.
被引用次数高达三万两千次:主流人工智能教科书《人工智能:一种现代方法》宣称,模拟退火“现在本身就是一个领域,每年都会发表数百篇论文”(第 155 页)。
cited a whopping thirty-two thousand times: The predominant AI textbook, Artificial Intelligence: A Modern Approach, declares that simulated annealing “is now a field in itself, with hundreds of papers published every year” (p. 155).
最有前途的优化方法之一:有趣的是,2014 年的一篇论文似乎证明水母在寻找食物时使用模拟退火;参见雷诺兹的“水母主动和被动优化 Lévy 搜索的特征”。
one of the most promising approaches to optimization: Intriguingly, a 2014 paper appears to demonstrate that jellyfish use simulated annealing in searching for food; see Reynolds, “Signatures of Active and Passive Optimized Lévy Searching in Jellyfish.”
“我自己不是赌徒”: Luria,《老虎机,一根破试管》,第75页。Garfield在《认识机会的作用》中也对此进行了讨论。
“Not a gambler myself”: Luria, A Slot Machine, a Broken Test Tube, p. 75. Also discussed in Garfield, “Recognizing the Role of Chance.”
创造了“serendipity”一词:在 Horace Walpole 写给 Horace Mann 的信中(日期为 1754 年 1 月 28 日)。
coined the term “serendipity”: In Horace Walpole, letter to Horace Mann (dated January 28, 1754).
“一个显著的相似之处”:詹姆斯,《伟人、伟大的思想和环境》。
“A remarkable parallel”: James, “Great Men, Great Thoughts, and the Environment.”
“盲目变异和选择性保留的过程”:坎贝尔,“盲目变异和选择性保留”。
“A blind-variation-and-selective-retention process”: Campbell, “Blind Variation and Selective Retention.”
“牛顿、莫扎特、理查德·瓦格纳等人”:引自同上。
“Newton, Mozart, Richard Wagner, and others”: Quoted in ibid.
“将你赶出框架的方式”:布莱恩·伊诺 (Brian Eno),在2001 年 5 月的《Later ... with Jools Holland》节目中接受朱尔斯·霍兰德 (Jools Holland) 的采访。
“ways of throwing you out of the frame”: Brian Eno, interviewed by Jools Holland, on Later … with Jools Holland, May 2001.
“模糊而持续的欲望”:这个词是saudade,引用的定义来自葡萄牙的贝尔。
“vague and constant desire”: The word is saudade, and the quoted definition comes from Bell, In Portugal.
“再这样下去就是愚蠢的”:蒂姆·亚当斯,《与生活搏斗》,《卫报》 ,2000 年 8 月 26 日。
“stupid to shake it up any further”: Tim Adams, “Dicing with Life,” Guardian, August 26, 2000.
10. 网络
10. NETWORKING
“连接 具有多种含义”: Cerf 和 Kahn,“分组网络互通协议”。
“connection has a wide variety of meanings”: Cerf and Kahn, “A Protocol for Packet Network Intercommunication.”
“只有联系”:福斯特,《霍华德庄园》。
“Only connect”: Forster, Howards End.
“手持式、便携式、真正的蜂窝电话”:马丁·库珀,《手机的发明者:我们知道有一天每个人都会拥有一部手机》,接受美国有线电视新闻网塔斯·安贾尔瓦拉采访,2010 年 7 月 9 日。
“handheld, portable, real cellular phone”: Martin Cooper, “Inventor of Cell Phone: We Knew Someday Everybody Would Have One,” interview with Tas Anjarwalla, CNN, July 9, 2010.
该消息是“登录”——或者本来是: Leonard Kleinrock 在 2014 年由 Charles Severence 主持的视频采访中讲述了这个故事,可在“Len Kleinrock:互联网上的前两个数据包”中观看,https://www.youtube.com/watch ?v=uY7dUJT7OsU 。
The message was “login”—or would have been: Leonard Kleinrock tells the story in a 2014 video interview conducted by Charles Severence and available at “Len Kleinrock: The First Two Packets on the Internet,” https://www.youtube.com/watch?v=uY7dUJT7OsU.
不祥之兆,如同《旧约》中那样:加州大学洛杉矶分校的伦纳德·克莱因罗克说:“我们没有计划这样做,但我们想不出比这更好的信息了:简短而具有预言性。” 如果将加州大学洛杉矶分校博尔特楼地砖的颜色解释为二进制的0和1,并解析为ASCII字符,就会拼出“LO AND BEHOLD!”(瞧!)这句话。这句致敬语归功于建筑师埃里克·哈根。例如,请参阅艾莉森·休伊特的《发现校园地砖中隐藏的加密信息》,加州大学洛杉矶分校新闻编辑室,2013年7月3日,http://newsroom.ucla.edu/stories/a-coded-message-hidden-in-floor-247232。
portentous and Old Testament despite himself: Says UCLA’s Leonard Kleinrock, “We didn’t plan it, but we couldn’t have come up with a better message: short and prophetic.” The tiles on the floor of UCLA’s Boelter Hall, if their colors are interpreted as binary 0s and 1s and parsed as ASCII characters, spell out the phrase “LO AND BEHOLD!” Credit for this tribute goes to architect Erik Hagen. See, e.g., Alison Hewitt, “Discover the Coded Message Hidden in Campus Floor Tiles,” UCLA Newsroom, July 3, 2013, http://newsroom.ucla.edu/stories/a-coded-message-hidden-in-floor-247232.
源于希腊语 protokollon :例如,参见在线词源词典,http://www.etymonline.com/index.php? term=protocol 。
rooted in the Greek protokollon: See, e.g., the Online Etymology Dictionary, http://www.etymonline.com/index.php?term=protocol.
“它们轰然 炸响! 而且很安静”: Leonard Kleinrock,《计算机对话:Len Kleinrock 谈数据包理论》,Charles Severance 访谈(2013)。参见https://www.youtube.com/watch?v=qsgrtrwydjw以及http://www.computer.org/csdl/mags/co/2013/08/mco2013080006.html。
“They go blast! and they’re quiet”: Leonard Kleinrock, “Computing Conversations: Len Kleinrock on the Theory of Packets,” interview with Charles Severance (2013). See https://www.youtube.com/watch?v=qsgrtrwydjw as well as http://www.computer.org/csdl/mags/co/2013/08/mco2013080006.html.
“彻头彻尾的异端邪说”:雅各布森,《看待网络的新方式》。
“utter heresy”: Jacobson, “A New Way to Look at Networking.”
“于是小男孩走了”: Kleinrock,《计算对话》。
“So little boy went away”: Kleinrock, “Computing Conversations.”
将被称为 分组交换: “分组交换”一词来自国家物理实验室的唐纳德·W·戴维斯 (Donald W. Davies),他是当时分组交换研究的另一位主要贡献者。
would become known as packet switching: The term “packet switching” comes from Donald W. Davies of the National Physical Laboratory, another key contributor to packet switching research at the time.
“两个端点之间的共识幻觉”:斯图尔特·柴郡,个人访谈,2015 年 2 月 26 日。
“a consensual illusion between the two endpoints”: Stuart Cheshire, personal interview, February 26, 2015.
通信如何在核攻击下幸存: Baran,“论分布式通信”。
communications could survive a nuclear attack: Baran, “On Distributed Communications.”
不断发展的网络成为一种美德:有关这一点的详细说明,以及对网络历史(包括其当前问题)的更广泛的思考,请参阅 Jacobson 的“看待网络的新方式”。
a growing network becomes a virtue: For elaboration on this point, and a broader reflection on the history of networking (including its current problems), see Jacobson, “A New Way to Look at Networking.”
通过“Avian Carriers” 的分组交换网络:有关Avian 协议的描述,请参阅 Waitzman 的《Avian Carriers 上 IP 数据报传输标准》、Waitzman 的《Avian Carriers 上的 IP 服务质量》以及 Carpenter 和 Hinden的《RFC 1149 针对 IPv6 的改编》,有关 2001 年 4 月 28 日在挪威卑尔根进行的实际实施的详细信息,请参阅http://www.blug.linux.no/rfc1149。
a packet-switching network over “Avian Carriers”: See Waitzman, A Standard for the Transmission of IP Datagrams on Avian Carriers, Waitzman, IP Over Avian Carriers with Quality of Service, and Carpenter and Hinden, Adaptation of RFC 1149 for IPv6 for descriptions of the avian protocol, and see http://www.blug.linux.no/rfc1149 for details of the actual implementation performed in Bergen, Norway, on April 28, 2001.
“没有任何传输能够做到 100% 可靠”: Cerf 和 Kahn,“分组网络互通协议”。
“No transmission can be 100 percent reliable”: Cerf and Kahn, “A Protocol for Packet Network Intercommunication.”
“拜占庭将军问题”: Lamport、Shostak 和 Pease,《拜占庭将军问题》。
the “Byzantine generals problem”: Lamport, Shostak, and Pease, “The Byzantine Generals Problem.”
表示序列已恢复:这里描述的过程称为“快速重传”。
signal that the sequence has been restored: The process being described here is known as “fast retransmit.”
几乎 10% 的上行互联网流量: Jon Brodkin,“Netflix 占据北美互联网9.5% 的上行流量:ACK 数据包使 Netflix 在高峰观看时段成为上传怪物”, Ars Technica,2014 年 11 月 20 日。Brodkin 又引用了 Sandvine 的《全球互联网现象报告》中的数据,https://www.sandvine.com/trends/global-internet-phenomena/。
almost 10% of upstream Internet traffic: Jon Brodkin, “Netflix takes up 9.5% of upstream traffic on the North American Internet: ACK packets make Netflix an upload monster during peak viewing hours,” Ars Technica, November 20, 2014. Brodkin in turn cites data from Sandvine’s Global Internet Phenomena Report, https://www.sandvine.com/trends/global-internet-phenomena/.
“接收器崩溃了吗?它们只是速度慢吗?”: Tyler Treat,《你无法实现恰好一次的交付》,《美丽新世界:一位软件工程师的反思》,2015 年 3 月 25 日,http://bravenewgeek.com/you-cannot-have-exactly-once-delivery/。
“Did the receiver crash? Are they just slow?”: Tyler Treat, “You Cannot Have Exactly-Once Delivery,” Brave New Geek: Introspections of a software engineer, March 25, 2015, http://bravenewgeek.com/you-cannot-have-exactly-once-delivery/.
“端到端重传恢复”: Vint Cerf,接受 Charles Severance 采访,“计算对话:Vint Cerf 谈数据包的历史”,2012 年。
“end-to-end retransmissions to recover”: Vint Cerf, interviewed by Charles Severance, “Computing Conversations: Vint Cerf on the History of Packets,” 2012.
“你只需说,‘再说一遍’”:同上。
“you just say, ‘Say that again’”: Ibid.
“世界上最难翻译的词”:奥利弗·康威,《刚果词语‘最无法翻译’》,英国广播公司新闻,2004 年 6 月 22 日。
“The world’s most difficult word to translate”: Oliver Conway, “Congo Word ‘Most Untranslatable,’” BBC News, June 22, 2004.
“如果一开始你没有成功”:托马斯·H·帕尔默,《教师手册》(1840 年),摘自《牛津谚语词典》(2009 年)。
“If at first you don’t succeed”: Thomas H. Palmer, Teacher’s Manual (1840), attested in The Oxford Dictionary of Proverbs, 2009.
试图将该大学的七个校区联系在一起:艾布拉姆森的“ALOHA 系统”。
trying to link together the university’s seven campuses: Abramson, “The ALOHA System.”
高于仅 18.6% 的平均利用率:同上。实际上,这个数字是1 ⁄ 2 e,恰好是第 1 章中关于最佳停止的讨论中给出的n ⁄ e或“37%”的一半。
above a mere 18.6% average utilization: Ibid. In fact, this figure is 1⁄2e, exactly half of the n⁄e, or “37%,” figure given in the discussion of optimal stopping in chapter 1.
“只有一个方案有希望奏效”: Jacobson,《拥塞避免和控制》。
“only one scheme has any hope of working”: Jacobson, “Congestion Avoidance and Control.”
一项名为 HOPE 的试点计划: Hawken 和 Kleiman 在《管理涉毒缓刑人员》一书中对 HOPE 计划进行了评估。
a pilot program called HOPE: The HOPE program is evaluated in Hawken and Kleiman, Managing Drug Involved Probationers.
“这是一种多么疯狂的改变尝试”:欲了解更多信息,请参阅“夏威夷的新缓刑计划超出统计数据”,PBS 新闻一小时,2014 年 2 月 2 日。
“what a crazy way to try to change”: For more information, see, e.g., “A New Probation Program in Hawaii Beats the Statistics,” PBS NewsHour, February 2, 2014.
“这种突然的千倍下降”: Jacobson,《拥塞避免和控制》。
“this sudden factor-of-thousand drop”: Jacobson, “Congestion Avoidance and Control.”
“然后它突然崩溃了”: Jacobson,《Van Jacobson:慢启动算法》,接受 Charles Severance 采访(2012 年),https://www.youtube.com/watch?v =QP4A6L7CEqA 。
“then it suddenly fell apart”: Jacobson, “Van Jacobson: The Slow-Start Algorithm,” interview with Charles Severance (2012), https://www.youtube.com/watch?v=QP4A6L7CEqA.
积极提升传输速率:这个初始过程——先尝试发送单个数据包,然后以“一加二”的速度加速——在 TCP 中被称为“慢启动”。这个名称部分用词不当:慢启动的“慢”之处在于它一开始只尝试发送一个数据包,但之后的指数级增长并非如此。
ramp up its transmission rate aggressively: This initial procedure—a tentative single packet followed by a two-for-one acceleration—is known in TCP as Slow Start. This name is a partial misnomer: Slow Start is “slow” in beginning with just a single tentative first packet, but not in its exponential growth thereafter.
“无等级控制”:参见 Gordon 的“无等级控制”。
“control without hierarchy”: See, e.g., Gordon, “Control without Hierarchy.”
蚂蚁的解决方案是类似的:将蚂蚁觅食与慢启动等流量控制算法联系起来的研究结果出现在 Prabhakar、Dektar 和 Gordon 的《没有空间信息的蚂蚁群落觅食活动的调节》中。
ants’ solution is similar: The findings that link ant foraging to flow control algorithms like Slow Start appear in Prabhakar, Dektar, and Gordon, “The Regulation of Ant Colony Foraging Activity without Spatial Information.”
“倾向于上升到他无能的水平”:彼得和赫尔,《彼得原理》。
“tends to rise to his level of incompetence”: Peter and Hull, The Peter Principle.
“每个公务员都应该被降职”:这句广为流传的格言在西班牙语原文中写道:“Todos los empleados públicos deberíanscender a su grado inmediato lower, porque han sido ascendidos hasta volverse incompetentes。”
“Every public servant should be demoted”: This widely reproduced aphorism, in the original Spanish, reads, “Todos los empleados públicos deberían descender a su grado inmediato inferior, porque han sido ascendidos hasta volverse incompetentes.”
由领先的律师事务所 Cravath, Swaine & Moore 设计: Cravath 系统在该事务所自己的网站上有官方记录:http://www.cravath.com/cravathsystem/。Cravath系统中的“晋升或退出”部分在该事务所网站上没有明确讨论,但在其他地方被广泛引用,例如美国律师协会:“20 世纪 20 年代,Cravath, Swaine & Moore 成为有记录以来第一家公开从法学院招聘的律师事务所,并明确表示,其聘用的许多年轻律师不会成为合伙人。那些没有与其他同学一起成为合伙人的律师将被要求离开事务所。然而,那些被认为是最优秀的律师,如果完成了必要的工作并在规定的年限内保持原职,则可以成为股东,获得同步增长的薪酬,并享受事务所的终身雇佣。” (Janet Ellen Raasch,《结成合伙人——或不结成合伙人:在二十一世纪是盛行、兴起还是终结?》,《法律实践》第 33 卷,第 4 期,2007 年 6 月。)
devised by leading law firm Cravath, Swaine & Moore: The Cravath System is officially documented at the firm’s own website: http://www.cravath.com/cravathsystem/. The “up or out” component of the Cravath System is not explicitly discussed there, but is widely referenced elsewhere, e.g., by the American Bar Association: “In the 1920s Cravath, Swaine & Moore became the first law firm on record to openly recruit from law schools with the express understanding that many of the young lawyers it hired would not make partner. Those associates who did not make partner with the rest of their class were expected to leave the firm. However, those deemed best among the associates, who did the necessary work and stayed on track for the requisite number of years, could expect to become stakeholders, earn lockstep increases in compensation, and enjoy lifetime employment in the firm.” (Janet Ellen Raasch, “Making Partner—or Not: Is It In, Up or Over in the Twenty-First Century?,” Law Practice 33, issue 4, June 2007.)
美国武装部队采用的:例如参见Rostker等人的《1980年国防军官人事管理法》。
the US Armed Forces adopted: See, e.g., Rostker et al., Defense Officer Personnel Management Act of 1980.
推行他们所谓的“人员控制”:例如参见迈克尔·史密斯的“陆军下士被迫离职‘以节省养老金现金’” ,《每日电讯报》 ,2002 年 7 月 29 日。
pursued what they call “manning control”: See, e.g., Michael Smith, “Army Corporals Forced Out ‘to Save Pension Cash,’” Telegraph, July 29, 2002.
仿佛所有交流都源于书面文本:正如巴维拉斯、科茨和约翰逊在《听众作为共同叙述者》一书中所言,“在大多数理论中,听众的立足点至多只有一线之隔。在极端情况下,听众被认为不存在或无关紧要,因为理论要么没有提及他们,要么将他们视为边缘人物。这种遗漏可能部分归因于所有语言使用都隐含地以书面文本为原型。”
as if all communication were written text: As Bavelas, Coates, and Johnson, “Listeners as Co-Narrators,” puts it, “Listeners have at best a tenuous foothold in most theories. At the extreme, listeners are considered nonexistent or irrelevant because the theory either does not mention them or treats them as peripheral. This omission may be attributed, in part, to the implicit use of written text as the prototype for all language use.”
“同时进行说和听”: Yngve,《插话》。
“simultaneously engaged in both speaking and listening”: Yngve, “On Getting a Word in Edgewise.”
“向心不在焉的听众讲述惊险故事的叙述者”: Bavelas、Coates 和 Johnson,“听众作为共同叙述者”。
“Narrators who told close-call stories to distracted listeners”: Bavelas, Coates, and Johnson, “Listeners as Co-Narrators.”
调节从说话者到听众的信息流: Tolins 和 Fox Tree,“收件人秘密渠道引导叙事发展”。
regulating the flow of information from speaker to listener: Tolins and Fox Tree, “Addressee Backchannels Steer Narrative Development.”
“‘糟糕的故事讲述者’至少可以部分地责怪他们的观众”:杰克逊·托林斯,私人信件,2015 年 1 月 15 日。
“‘bad storytellers’ can at least partly blame their audience”: Jackson Tolins, personal correspondence, January 15, 2015.
“对排队的原因和意义的误解”: Nichols 和 Jacobson,“控制队列延迟”。
“misconceptions about the cause and meaning of queues”: Nichols and Jacobson, “Controlling Queue Delay.”
至今仍在使用的 HTTP 规范:即 HTTP 1.1,如 1999 年 6 月的 RFC 2616 文档中所述,可在http://tools.ietf.org/html/rfc2616上找到。
the HTTP specification still in use today: That is HTTP 1.1, as articulated in the RFC 2616 document from June 1999, available at http://tools.ietf.org/html/rfc2616.
“我碰巧在复制或 rsyncing”: Jim Gettys,“Bufferbloat:互联网中的暗缓冲区”,Google Tech Talk,2011 年 4 月 26 日。
“I happened to be copying, or rsyncing”: Jim Gettys, “Bufferbloat: Dark Buffers in the Internet,” Google Tech Talk, April 26, 2011.
“不是‘尤里卡!’而是‘真有趣’”:这句话出现在无数出版物中,并被归为艾萨克·阿西莫夫所写,但其真正的作者和出处至今仍难以确定。这句话最初似乎出现在 UNIX 系统“fortune”程序中,并附有阿西莫夫的署名。该程序以幸运饼干的形式显示引言或谚语。参见http://quoteinvestigator.com/2015/03/02/eureka-funny/。阿西莫夫确实写过一篇关于“尤里卡现象”的文章,但这句话并没有出现在那里。
“not ‘Eureka!’ but ‘That’s funny’”: This quotation has appeared in countless publications with an attribution to Isaac Asimov, but its actual authorhip and provenance remain elusive. It seems to have first shown up—complete with the Asimov attribution—as part of the UNIX “fortune” program, which displays quotes or sayings in the style of a fortune cookie. See http://quoteinvestigator.com/2015/03/02/eureka-funny/. Asimov did write an essay about “The Eureka Phenomenon,” but this phrase does not appear there.
当它们被例行清零时:参见 Nichols 和 Jacobson 的“控制队列延迟”。
when they are routinely zeroed out: See Nichols and Jacobson, “Controlling Queue Delay.”
比她家乡加利福尼亚州的人口还要多:美国人口普查局2015年估计加州人口为39,144,818。详情请参阅http://www.census.gov/popest/data/state/totals/2015/index.html。
than her home state of California has people: The US Census Bureau’s 2015 estimate for California’s population was 39,144,818. See http://www.census.gov/popest/data/state/totals/2015/index.html.
“没有真正好的办法给人们留言”:雷·汤姆林森接受杰西·希克斯采访,“电子邮件的发明者雷·汤姆林森:‘我发现电子邮件的使用方式总体上与我预想的完全一样’”,Verge,2012 年 5 月 2 日,http://www.theverge.com/2012/5/2/2991486/ray-tomlinson-email-inventor-interview-i-see-email-being-used。
“no really good way to leave messages for people”: Ray Tomlinson, interviewed by Jesse Hicks, “Ray Tomlinson, the Inventor of Email: ‘I See Email Being Used, by and Large, Exactly the Way I Envisioned,’” Verge, May 2, 2012, http://www.theverge.com/2012/5/2/2991486/ray-tomlinson-email-inventor-interview-i-see-email-being-used.
直接拒绝所有来电:谢菲尔德大学认知科学家汤姆·斯塔福德就采取了这样的做法。在他2015年休假期间,他的自动邮件回复是:“我现在休假到6月12日。发送至t.stafford@shef.ac.uk的邮件已被删除。”
simply rejecting all incoming messages: One such approach was taken, for instance, by University of Sheffield cognitive scientist Tom Stafford. During his 2015 sabbatical, his automated email response read: “I am now on sabbatical until 12th June. Email sent to t.stafford@shef.ac.uk has been deleted.”
显式拥塞通知 (ECN): ECN 的征求意见稿 (RFC) 文档是 Ramakrishnan、Floyd 和 Black 合著的《在 IP 中添加显式拥塞通知 (ECN)》,该文档是 Ramakrishnan 和 Floyd 合著的《在 IP 中添加显式拥塞通知 (ECN) 的提案》 的修订版。尽管最初的提案可以追溯到 20 世纪 90 年代,但 ECN 至今仍未在标准网络硬件中实现(Stuart Cheshire,个人访谈,2015 年 2 月 26 日)。
Explicit Congestion Notification, or ECN: The Request for Comments (RFC) document for ECN is Ramakrishnan, Floyd, and Black, The Addition of Explicit Congestion Notification (ECN) to IP, which is a revision of Ramakrishnan and Floyd, A Proposal to Add Explicit Congestion Notification (ECN) to IP. Though the original proposal dates from the 1990s, ECN remains unimplemented in standard networking hardware today (Stuart Cheshire, personal interview, February 26, 2015).
“这是一个长期的沼泽”:吉姆·盖蒂斯,个人采访,2014 年 7 月 15 日。
“This is a long-term swamp”: Jim Gettys, personal interview, July 15, 2014.
“你会说波音747‘快’三倍吗?”:这句话出自柴郡1996年著名的“咆哮”:“问题在于延迟,笨蛋。” 请参阅http://stuartcheshire.org/rants/Latency.html。二十年后,这种观点更加真实。
“would you say that a Boeing 747 is three times ‘faster’”: This comes from Cheshire’s famous 1996 “rant” “It’s the Latency, Stupid.” See http://stuartcheshire.org/rants/Latency.html. Twenty years later, the sentiment is only truer.
11.博弈论
11. GAME THEORY
“我相信人类是高尚而光荣的”:史蒂夫·乔布斯接受加里·沃尔夫采访,《连线》杂志,1996 年 2 月。
“I believe humans are noble and honorable”: Steve Jobs, interview with Gary Wolf, Wired, February 1996.
人与自然:二十一世纪的小学生越来越多地学习“人与自然”、“人与自我”、“人与人”和“人与社会”。
man vs. nature: Appropriately, schoolchildren in the twenty-first century increasingly learn about “person vs. nature,” “person vs. self,” “person vs. person,” and “person vs. society.”
“聪明人会把毒药倒入自己的酒杯中”: 《公主新娘》,剧本由威廉·戈德曼撰写;二十世纪福克斯,1987 年。
“a clever man would put the poison into his own goblet”: The Princess Bride, screenplay by William Goldman; 20th Century Fox, 1987.
“预测他人的预期”:出自凯恩斯,格雷戈里·伯格曼,《主义》,亚当斯媒体,2006 年。
“anticipating the anticipations of others”: Attributed to Keynes in Gregory Bergman, Isms, Adams Media, 2006.
正是停机问题启发了图灵:艾伦·图灵在《论可计算数及其在判定问题中的应用》和《论可计算数及其在判定问题中的应用:更正》中考虑了停机问题并提出了图灵机。
it was the halting problem that inspired Turing: Alan Turing considers the halting problem and proposes the Turing machine in “On Computable Numbers, with an Application to the Entscheidungsproblem” and “On Computable Numbers, with an Application to the Entscheidungsproblem. A Correction.”
“扑克玩家称之为‘升级’”:丹·史密斯,个人采访,2014 年 9 月 11 日。
“poker players call it ‘leveling’”: Dan Smith, personal interview, September 11, 2014.
“你没有 27”:这是 2009 年 11 月 17 日至 19 日在伦敦 Les Ambassadeurs Club 举行的“Full Tilt Poker Durrrr 百万美元挑战赛”上发生的,并在天空体育台进行了电视转播。
“You don’t have deuce–seven”: This took place at the “Full Tilt Poker Durrrr Million Dollar Challenge,” held at Les Ambassadeurs Club in London, November 17–19, 2009, and was televised on Sky Sports.
“只想比对手高一级”: Vanessa Rousso,《Leveling Wars》,https://www.youtube.com/watch?v =Yt5ALnFrwR4 。
“only want to play one level above your opponent”: Vanessa Rousso, “Leveling Wars,” https://www.youtube.com/watch?v=Yt5ALnFrwR4.
“了解或试图了解纳什是什么”:丹·史密斯,个人访谈,2014 年 9 月 11 日。
“knowing or trying to know what Nash is”: Dan Smith, personal interview, September 11, 2014.
所谓的 均衡:博弈论均衡的概念——以及博弈论本身——来自普林斯顿大学的约翰·冯·诺依曼和奥斯卡·摩根斯特恩的《博弈论与经济行为》。
a so-called equilibrium: The concept of a game-theoretic equilibrium—and, for that matter, game theory itself—comes from Princeton’s John von Neumann and Oskar Morgenstern in Theory of Games and Economic Behavior.
以石头剪刀布为例:想要更深入地了解石头剪刀布(“RPS”)锦标赛的玩法,包括各种三步“策略”的词汇表,例如雪崩(RRR)、官僚(PPP)和荒野大镖客(RPP),我们推荐访问http://worldrps.com。想要了解计算机RPS的玩法,请访问石头剪刀布编程大赛:http://www.rpscontest.com。
In rock-paper-scissors, for example: For a colorful look into rock-paper-scissors (“RPS”) tournament play, including a glossary of the game’s various three-move “gambits”—like the Avalanche (RRR), the Bureaucrat (PPP), and Fistful o’ Dollars (RPP)—we recommend http://worldrps.com. For a look into computer RPS play, check out the Rock Paper Scissors Programming Competition: http://www.rpscontest.com.
完全随机地选择一个同名的手势:像这样融合了随机性的策略被称为“混合”策略。另一种策略是“纯”策略,它总是选择完全相同的选项;这在石头剪刀布游戏中显然不会长期有效。混合策略是许多博弈中均衡的一部分,尤其是在“零和”博弈中,玩家的利益直接相互对立。
choose one of the eponymous hand gestures completely at random: A strategy, like this one, that incorporates randomness is called a “mixed” strategy. The alternative is a “pure” strategy, which always involves taking the exact same option; this clearly would not work for long in rock-paper-scissors. Mixed strategies appears as part of the equilibrium in many games, especially in “zero-sum” games, where the interests of the players are pitted directly against one another.
每个 双人游戏至少有一个均衡点:纳什,“ N人游戏中的均衡点”;纳什,“非合作博弈”。
every two-player game has at least one equilibrium: Nash, “Equilibrium Points in N-Person Games”; Nash, “Non-Cooperative Games.”
纳什均衡总是存在的事实:更准确地说,同上证明了每个具有有限数量玩家和有限数量策略的游戏都至少有一个混合策略均衡。
the fact that a Nash equilibrium always exists: To be more precise, ibid. proved that every game with a finite number of players and a finite number of strategies has at least one mixed-strategy equilibrium.
“产生了根本性的、普遍的影响”:迈尔森,《纳什均衡与经济理论史》。
“has had a fundamental and pervasive impact”: Myerson, “Nash Equilibrium and the History of Economic Theory.”
“计算机科学家最关心的问题”: Papadimitriou,《前言》。
“a computer scientist’s foremost concern”: Papadimitriou, “Foreword.”
“给我们一些可以用的东西”: Tim Roughgarden,《算法博弈论,讲座 1(导论)》,2013 年秋季,https://www.youtube.com/watch?v =TM_QFmQU_VA 。
“Give us something we can use”: Tim Roughgarden, “Algorithmic Game Theory, Lecture 1 (Introduction),” Autumn 2013, https://www.youtube.com/watch?v=TM_QFmQU_VA.
都被证明是棘手的问题: Gilboa 和 Zemel,“纳什和相关均衡”。
all been proved to be intractable problems: Gilboa and Zemel, “Nash and Correlated Equilibria.”
仅仅 寻找 纳什均衡是难以解决的:具体来说,寻找纳什均衡被证明属于一类称为PPAD 的问题,人们普遍认为它(像NP一样)是难以解决的。纳什均衡和PPAD之间的联系是在 Daskalakis、Goldberg 和 Papadimitriou 的《计算纳什均衡的复杂性》以及 Goldberg 和 Papadimitriou 的《均衡问题之间的可约性》中建立的,后来由 Chen 和 Deng 扩展到双人游戏《解决双人纳什均衡的复杂性》,然后在 Daskalakis、Goldberg 和 Papadimitriou 的《计算纳什均衡的复杂性》中得到进一步推广。PPAD代表“有向图上的多项式奇偶校验论证”;帕帕迪米特里奥在《论复杂性作为有限理性》一书中将这类问题命名为“帕帕迪米特里奥”,他坚称任何与他名字相似之处纯属巧合。(克里斯托斯·帕帕迪米特里奥,个人访谈,2014年9月4日)
simply finding Nash equilibria is intractable: Specifically, finding Nash equilibria was shown to belong to a class of problems called PPAD, which (like NP) is widely believed to be intractable. The link between Nash equilibria and PPAD was established in Daskalakis, Goldberg, and Papadimitriou, “The Complexity of Computing a Nash Equilibrium” and Goldberg and Papadimitriou, “Reducibility Between Equilibrium Problems,” which was then extended to two-player games by Chen and Deng, “Settling the Complexity of Two-Player Nash Equilibrium,” and then further generalized in Daskalakis, Goldberg, and Papadimitriou, “The Complexity of Computing a Nash Equilibrium.” PPAD stands for “Polynomial Parity Arguments on Directed graphs”; Papadimitriou, who named this class of problems in “On Complexity as Bounded Rationality,” insists any resemblance to his name is a coincidence. (Christos Papadimitriou, personal interview, September 4, 2014.)
PPAD包含其他有趣的问题,例如火腿三明治问题:给定n维空间中的n组 2n 个点,找到一个平面将每组点恰好分成两半。(当n = 3 时,这涉及计算出一把刀将三组点切成两半所需的路径;如果这三组点分别对应两片面包和一片火腿,那么结果就是一个被完美平分的三明治。)寻找纳什均衡实际上是PPAD完全的,这意味着如果存在一种有效的算法来解决它,那么该类中的所有其他问题也可以得到有效解决(包括制作世界上最精致的三明治)。但是,PPAD完全并不像NP完全那么糟糕。P ,即可有效解决的问题类,可以等于PPAD而不等于NP。截至撰写本文时,尚无定论:理论上有可能有人可以设计出一种有效的算法来寻找纳什均衡,但大多数专家并不抱太大希望。
PPAD contains other interesting problems, such as the ham sandwich problem: given n sets of 2n points in n dimensions, find a plane that divides each set of points exactly in half. (With n = 3, this involves figuring out the path a knife would have to travel to cut three sets of points in half; if those sets of points correspond to two pieces of bread and a piece of ham, the result is a perfectly bisected sandwich.) Finding Nash equilibria is actually PPAD-complete, meaning that if there were an efficient algorithm for solving it then all other problems in the class could also be solved efficiently (including making the world’s neatest sandwiches). But being PPAD-complete is not quite so bad as being NP-complete. P, the class of efficiently solvable problems, could be equal to PPAD without being equal to NP. As of this writing the jury is still out: it’s theoretically possible that somebody could devise an efficient algorithm for finding Nash equilibria, but most experts aren’t holding their breath.
“其作为预测的可信度很高”: Christos Papadimitriou,《寻找纳什均衡的复杂性》,载于 Nisan 等人的《算法博弈论》。
“much of its credibility as a prediction”: Christos Papadimitriou, “The Complexity of Finding Nash Equilibria,” in Nisan et al., Algorithmic Game Theory.
“也应该被认为是相关的”: Aaronson,“为什么哲学家应该关心计算复杂性。”
“should be considered relevant also”: Aaronson, “Why Philosophers Should Care About Computational Complexity.”
“如果你的笔记本电脑找不到它”:在 Christos Papadimitriou 的“寻找纳什均衡的复杂性”中,Nisan 等人,算法博弈论,第 30 页。
“If your laptop cannot find it”: In Christos Papadimitriou, “The Complexity of Finding Nash Equilibria,” in Nisan et al., Algorithmic Game Theory, p. 30.
“囚徒困境”:囚徒困境最初是由梅里尔·弗勒德(因秘书问题和旅行商问题而闻名)和兰德公司的梅尔文·德雷舍尔提出的。1950年1月,他们安排加州大学洛杉矶分校的阿尔曼·阿尔奇安和兰德公司的约翰·D·威廉姆斯之间进行了一场博弈,其收益类似于囚徒困境(弗勒德,《一些实验博弈》)。普林斯顿大学的阿尔伯特·塔克对这个实验很感兴趣,在准备于当年5月在斯坦福大学的一次演讲中讨论这个实验时,他提出了现在著名的“囚徒困境”公式并命名了这个问题。庞德斯通的《囚徒困境》一书详细介绍了博弈论的起源及其在兰德公司工作中的发展。
“the prisoner’s dilemma”: The prisoner’s dilemma was first conceived by Merrill Flood (of secretary problem and traveling salesman problem fame) and Melvin Drescher at RAND Corporation. In January 1950, they staged a game between UCLA’s Armen Alchian and RAND’s John D. Williams that had prisoner’s dilemma–like payoffs (Flood, “Some Experimental Games”). Princeton’s Albert Tucker was intrigued by this experiment, and in preparing to discuss it that May in a lecture at Stanford, he gave the problem its now famous prison formulation and its name. A detailed history of the origins of game theory and its development in the work of the RAND Corporation can be found in Poundstone, Prisoner’s Dilemma.
无政府状态的代价仅为 4/3: Roughgarden 和 Tardos,“自私路由有多糟糕?” Roughgarden 2002 年在康奈尔大学获得的博士学位也探讨了自私路由的话题。
a price of anarchy that’s a mere 4/3: Roughgarden and Tardos, “How Bad Is Selfish Routing?” Roughgarden’s 2002 Cornell PhD also addresses the topic of selfish routing.
“悲观主义者担心这是真的”:卡贝尔,《银色种马》。
“the pessimist fears this is true”: Cabell, The Silver Stallion.
描绘公共草坪的“公共用地”:哈丁,《公地悲剧》。
picture a “commons” of public lawn: Hardin, “The Tragedy of the Commons.”
“有一种东西叫做含铅汽油”:阿夫里姆·布鲁姆,个人采访,2014 年 12 月 17 日。
“there was this thing called leaded gasoline”: Avrim Blum, personal interview, December 17, 2014.
标题简明扼要地提出了问题:斯科特·K·约翰逊,“稳定的气候要求大多数化石燃料留在地下,但是谁的呢?”,Ars Technica,2015 年 1 月 8 日。
headline put the trouble succinctly: Scott K. Johnson, “Stable Climate Demands Most Fossil Fuels Stay in the Ground, but Whose?,” Ars Technica, January 8, 2015.
“没有什么地方比这里更能体现工作的价值了”: “追忆似水年华”,《经济学人》,2014 年 12 月 20 日。
“nowhere is the value of work higher”: “In Search of Lost Time,” Economist, December 20, 2014.
15% 的人根本不休假:该研究来自 Glassdoor,并在上文中引用。
15% take no vacation at all: The study is from Glassdoor and is referenced in ibid.
“人们会犹豫是否要休假”: Mathias Meyer,《从开放(无限制)到最低休假政策》,2014 年 12 月 10 日,http://www.paperplanes.de/2014/12/10/from-open-to-minimum-vacation-policy.html。
“People will hesitate to take a vacation”: Mathias Meyer, “From Open (Unlimited) to Minimum Vacation Policy,” December 10, 2014, http://www.paperplanes.de/2014/12/10/from-open-to-minimum-vacation-policy.html.
“商店比以往都开门更早”:妮可·马萨布鲁克,《2014 年感恩节商店开业:沃尔玛、塔吉特、百思买及其他商店感恩节营业时间》,《国际商业时报》 ,2014 年 11 月 26 日。
“Stores are opening earlier than ever before”: Nicole Massabrook, “Stores Open on Thanksgiving 2014: Walmart, Target, Best Buy and Other Store Hours on Turkey Day,” International Business Times, November 26, 2014.
“不要恨玩家,要恨游戏”: Ice-T,《不要恨玩家》,《第七宗罪》,1999 年。
“Don’t hate the player, hate the game”: Ice-T, “Don’t Hate the Playa,” The Seventh Deadly Sin, 1999.
“永远不要站在任何反对家庭的人一边”: 《教父》,剧本由马里奥·普佐和弗朗西斯·福特·科波拉编写,派拉蒙影业公司,1972 年。
“Don’t ever take sides with anyone against the family”: The Godfather, screenplay by Mario Puzo and Francis Ford Coppola, Paramount Pictures, 1972.
“不利于合作的出现”:宾莫尔的这句引言出现在许多文献中,包括宾莫尔的《自然正义论》和宾莫尔的《博弈论》。康德的“绝对命令”源于他1785年的《道德形而上学基础》 ,并在他1788年的《实践理性批判》中进行了讨论。
“loaded against the emergence of cooperation”: This quotation of Binmore’s appears in a number of sources, including Binmore, Natural Justice, and Binmore, Game Theory. Kant’s “categorical imperative” originates in his 1785 Groundwork of the Metaphysic of Morals and is discussed in his 1788 Critique of Practical Reason.
休假可获一千美元现金:利宾在接受亚当布莱恩特采访时讨论了这一千美元的动机,例如,《纽约时报》 ,2012 年 4 月 7 日。
a thousand dollars cash for taking a vacation: Libin discusses the motivations for the thousand dollars in, for instance, an interview with Adam Bryant, “The Phones Are Out, but the Robot Is In,” New York Times, April 7, 2012.
强制规定最低休假时长:强制休假已成为金融业的标准做法,尽管其目的并非为了鼓舞士气,而是出于识别欺诈行为的需要。更多关于强制休假和欺诈行为的信息,请参阅菲利普·德尔维斯·布劳顿的文章“休两周假——否则……”,《华尔街日报》,2012年8月28日。
make a certain minimal amount of vacation compulsory: Compulsory vacation is already a standard practice in finance, although for reasons of fraud detection rather than morale. For more on compulsory vacation and fraud see, e.g., Philip Delves Broughton, “Take Those Two Weeks Off—or Else,” Wall Street Journal, August 28, 2012.
没有联邦带薪休假要求: Rebecca Ray、Milla Sanes 和 John Schmitt,《重访无休假国家》,经济政策与研究中心,2013 年 5 月,http://www.cepr.net/index.php/publications/reports/no-vacation-nation-2013。
without federal requirements for paid vacation: Rebecca Ray, Milla Sanes, and John Schmitt, “No-Vacation Nation Revisited,” Center for Economic Policy and Research, May 2013, http://www.cepr.net/index.php/publications/reports/no-vacation-nation-2013.
计算机科学家很少谈论的事情:Donald E. Knuth。
Things a Computer Scientist Rarely Talks About: Donald E. Knuth.
“心自有其理由”:正如帕斯卡在《Pascal, Pensées sur la religion et sur quelques autres sujets》第 277 节中所说:“Le cœur a ses raisons, que la raison ne connaît point。”
“The heart has its reasons”: As Pascal put it in Pascal, Pensées sur la religion et sur quelques autres sujets, §277: “Le cœur a ses raisons, que la raison ne connaît point.”
“树冠可以被认为是一片空中草地”:道金斯,《进化的证据》。
“The canopy can be thought of as an aerial meadow”: Dawkins, The Evidence for Evolution.
使老鼠永远不再害怕猫: Ingram 等人,“感染低毒力弓形虫菌株的老鼠”。
makes mice permanently lose their fear of cats: Ingram et al., “Mice Infected with Low-Virulence Strains of Toxoplasma Gondii.”
“道德是个人的群体本能”: 《快乐的科学》,第 116 节,沃尔特·考夫曼译。
“Morality is herd instinct in the individual”: The Gay Science, §116, trans. Walter Kaufmann.
“如果人们 期望 我们做出非理性的反应”:弗兰克,《理性中的激情》。
“If people expect us to respond irrationally”: Frank, Passions within Reason.
“担心人们会离开这段关系”:同上。
“The worry that people will leave relationships”: Ibid.
“你需要一种让你不想分离的感觉”:罗伯特·弗兰克,个人访谈,2015 年 4 月 13 日。弗兰克的《如果经济人可以选择》包含了这一观点,尽管他很快承认,这一观点建立在谢林的《冲突策略》;谢林的《利他主义、卑鄙和其他潜在战略行为》;阿克洛夫的《忠诚过滤器》;赫什莱弗的《论情感作为威胁和承诺的保证者》;森的《目标、承诺和身份》;以及高蒂尔的《协议下的道德》等著作之上。弗兰克在《理性内的激情》一书中用很长的篇幅讨论了这些观点。
“you need a feeling that makes you not want to separate”: Robert Frank, personal interview, April 13, 2015. Frank, “If Homo Economicus Could Choose,” contains this idea, though as he is quick to acknowledge, it builds on work such as Schelling, The Strategy of Conflict; Schelling, “Altruism, Meanness, and Other Potentially Strategic Behaviors”; Akerlof, “Loyalty Filters”; Hirshleifer, “On the Emotions as Guarantors of Threats and Promises”; Sen, “Goals, Commitment, and Identity”; and Gauthier, Morals by Agreement. Frank treats the ideas at book length in Passions within Reason.
“如果囚犯快乐,为什么要把他锁起来?”:肖邦、曼和超人。
“If the prisoner is happy, why lock him in?”: Shaw, Man and Superman.
谷歌超过90%的收入来自广告销售:根据其股东报告,谷歌2014年的广告收入为596亿美元,约占其660亿美元总收入的90.3%。详情请参阅https://investor.google.com/financial/tables.html。
makes more than 90% of its revenue from selling ads: Google’s 2014 advertising revenue, as detailed in its shareholder report, was $59.6 billion, roughly 90.3% of its total revenue of $66 billion. See https://investor.google.com/financial/tables.html.
增加数百亿美元收入: AWS-3 电力线拍卖于 2015 年 1 月 29 日结束,最终中标金额达 448.99 亿美元。详情请参阅http://wireless.fcc.gov/auctions/default.htm?job=auction_factsheet&id=97。
raising tens of billions of dollars in revenue: The AWS-3 auction that closed on January 29, 2015, resulted in winning bids totaling $44.899 billion. See http://wireless.fcc.gov/auctions/default.htm?job=auction_factsheet&id=97.
他们会根据对您的预测来调整出价!:对于有两个参与者的密封投标第一价格拍卖,均衡策略是您出价正好是您认为该物品价值的一半。更一般地,在这种有n 个参与者的拍卖形式中,您应该出价正好是您认为该物品价值的( n −1) ⁄ n倍。请注意,此策略是纳什均衡,但不是主导策略;也就是说,如果其他人也这样做,那就没有什么更好,但在所有情况下都不一定是最优的。买者自慎。此外,如果您不知道拍卖中的竞标者数量,最佳策略很快就会变得复杂;例如,请参阅 An、Hu 和 Shum 的“估算投标人数量未知的第一价格拍卖:一种错误分类方法”。实际上,即使是看似清晰的结果—— ( n −1) ⁄ n——也需要一些严谨的假设,即投标人“风险中性”,并且他们对物品的不同估值在给定范围内均匀分布。这里的( n −1) ⁄ n结果来自维克里在《反投机、拍卖和竞争性密封投标》一书中提出的结论。他警告说:“如果放弃投标人同质性的假设,那么完整处理方案的数学计算将变得难以处理。”
they’re shading their bids based on their prediction of yours!: The equilibrium strategy for a sealed-bid first-price auction with two players is to bid exactly half what you think the item is worth. More generally, in this auction format with n players, you should bid exactly (n−1)⁄n times what you think the item is worth. Note that this strategy is the Nash equilibrium but is not a dominant strategy; that is to say, nothing is better if everyone else is doing it, too, but isn’t necessarily optimal under all circumstances. Caveat emptor. Also, if you don’t know the number of bidders in the auction, the optimal strategy gets complicated in a hurry; see, for instance, An, Hu, and Shum, “Estimating First-Price Auctions with an Unknown Number of Bidders: A Misclassification Approach.” Actually, even the seemingly clean results—(n−1)⁄n—require some serious assumptions, namely that the bidders are “risk neutral” and that their different values for the item are distributed evenly across some given range. The (n−1)⁄n result here comes from Vickrey, “Counterspeculation, Auctions, and Competitive Sealed Tenders,” who warns, “If the assumption of homogeneity among the bidders be abandoned, the mathematics of a complete treatment become intractable.”
全球最大的鲜花拍卖会:有关阿斯梅尔鲜花拍卖会的更多信息,请访问http://www.floraholland.com/en/about-floraholland/visit-the-flower-auction/。
the largest flower auction in the world: For more about the Aalsmeer Flower Auction, see http://www.floraholland.com/en/about-floraholland/visit-the-flower-auction/.
一群人一起坠崖:有时,这些悬崖的描述过于直白。例如,《纽约时报》报道了华盛顿州几名经验丰富的越野滑雪者丧生的事件。幸存者的叙述表明,一群技艺精湛的滑雪者最终做出了一件几乎所有成员都感到不快的事情。
a bunch of people all going over a cliff together: Sometimes these cliffs are all too literal. The New York Times, for instance, reported on the deaths of several experienced backcountry skiers in Washington State. The accounts of the survivors show how a group of extremely skilled skiers ended up doing something that almost all the individual members had a bad feeling about.
“如果由我决定,我绝不会和12个人一起去野外滑雪,”一位幸存者说道。“那实在太多了。但那样做也有点社交因素——我不想成为那个说‘嘿,这群人太多了,我们不应该这么做’的人。”
“If it was up to me, I would never have gone backcountry skiing with twelve people,” said one survivor. “That’s just way too many. But there were sort of the social dynamics of that—where I didn’t want to be the one to say, you know, ‘Hey, this is too big a group and we shouldn’t be doing this.’”
“我们这群人不可能做出不明智的决定,”另一个人自言自语道。“当然可以,只要我们都去。一定没问题。”
“There’s no way this entire group can make a decision that isn’t smart,” another said to himself. “Of course it’s fine, if we’re all going. It’s got to be fine.”
“我脑子里全是想让他们停下来,”第三个人说道。
“Everything in my mind was going off, wanting to tell them to stop,” said a third.
“我当时想:哦,是啊,那地方真糟糕,”第四名成员回忆道。“那么多人待在那儿真糟糕。但我什么也没说。我不想惹麻烦。”
“I thought: Oh yeah, that’s a bad place to be,” recounted a fourth member of the party. “That’s a bad place to be with that many people. But I didn’t say anything. I didn’t want to be the jerk.”
正如《纽约时报》总结的那样:“这群当地人都以为自己知道其他人在想什么。但他们并不知道。” 参见布兰奇,“降雪”。
As the Times summarized: “All the locals in the group presumed they knew what the others were thinking. They did not.” See Branch, “Snow Fall.”
被称为“信息瀑布”: Bikhchandani、Hirshleifer 和 Welch 合著的《时尚理论》。另请参阅 Bikhchandani、Hirshleifer 和 Welch 合著的《从他人行为中学习》。
known as an “information cascade”: Bikhchandani, Hirshleifer, and Welch, “A Theory of Fads.” See also Bikhchandani, Hirshleifer, and Welch, “Learning from the Behavior of Others.”
“公共信息池不再增长”:David Hirshleifer,个人访谈,2014 年 8 月 27 日。
“the public pool of information is no longer growing”: David Hirshleifer, personal interview, August 27, 2014.
售价超过 2300 万美元:加州大学伯克利分校生物学家迈克尔·艾森 (Michael Eisen) 注意到了亚马逊这本特定书籍的定价,并对其进行了报道;请参阅艾森博客 2011 年 4 月 23 日的文章“亚马逊售价 23,698,655.93 美元的有关苍蝇的书”,这不是垃圾,http://www.michaeleisen.org/blog/? p=358 。
a sale price of more than $23 million: The pricing on this particular Amazon title was noticed and reported on by UC Berkeley biologist Michael Eisen; see “Amazon’s $23,698,655.93 book about flies,” April 23, 2011 on Eisen’s blog it is NOT junk, http://www.michaeleisen.org/blog/?p=358.
加剧市场的非理性:例如,参见哥伦比亚大学经济学家拉吉夫·塞西(Rajiv Sethi)在闪电崩盘后立即做出的反应。塞西,《算法交易与价格波动》。
worsen the irrationality of the market: See, for instance, the reactions of Columbia University economist Rajiv Sethi in the immediate wake of the flash crash. Sethi, “Algorithmic Trading and Price Volatility.”
拯救整个群体免于灾难:这也可以从机制设计和进化的角度来思考。平均而言,对于任何特定个体来说,做一个略微谨慎的群体追随者会更好,但群体中一些固执己见、特立独行的成员的存在也会让每个人都受益。这样一来,过度自信可以被认为是一种利他主义。更多关于此类群体成员“社会最优比例”的信息,请参阅Bernardo 和 Welch 的《论过度自信与企业家的演化》。
save the entire herd from disaster: This can also be thought of in terms of mechanism design and evolution. It is better on average for any particular individual to be a somewhat cautious herd follower, yet everyone benefits from the presence of some group members who are headstrong mavericks. In this way, overconfidence can be thought of as a form of altruism. For more on the “socially optimal proportion” of such group members, see Bernardo and Welch, “On the Evolution of Overconfidence and Entrepreneurs.”
重新思考机制设计的一种方式: “算法机制设计”这一短语首次进入技术文献是在 Nisan 和 Ronen 的《算法机制设计》中。
a way to rethink mechanism design: The phrase “algorithmic mechanism design” first entered the technical literature in Nisan and Ronen, “Algorithmic Mechanism Design.”
它被称为维克里拍卖:参见维克里,“反投机、拍卖和竞争性密封投标”。
It’s called the Vickrey auction: See Vickrey, “Counterspeculation, Auctions, and Competitive Sealed Tenders.”
“策略证明”,或简称为“真实”: “策略证明”游戏也被称为“激励相容”。请参阅Noam Nisan的《机制设计导论(面向计算机科学家)》,载于Nisan等人编的《算法博弈论》。
“strategy-proof,” or just “truthful”: “Strategy-proof” games are also known as “incentive-compatible.” See Noam Nisan, “Introduction to Mechanism Design (for Computer Scientists),” in Nisan et al., eds., Algorithmic Game Theory.
诚实是主导策略:用博弈论的术语来说,这使得维克里拍卖成为“主导策略激励相容”(DSIC)的拍卖。算法博弈论中的一个重要结论,即“迈尔森引理”,断言只有一种可能的DSIC支付机制。这意味着维克里拍卖不仅仅是一种避免策略性、递归性或不诚实行为的方法,它是唯一的方法。参见迈尔森的《最优拍卖设计》。
honesty is the dominant strategy: In game theory terms, this makes the Vickrey auction “dominant-strategy incentive-compatible” (DSIC). And a major result in algorithmic game theory, known as “Myerson’s Lemma,” asserts that there is only one DSIC payment mechanism possible. This means that the Vickrey auction is not just a way to avoid strategic, recursive, or dishonest behavior—it’s the only way. See Myerson, “Optimal Auction Design.”
一个名为“收入等价”的博弈论原理:收入等价定理起源于维克里(Vickrey)的《反投机、拍卖和竞争性密封投标》,并在迈尔森(Myerson)的《最优拍卖设计》以及莱利(Riley)和萨缪尔森(Samuelson)的《最优拍卖》中得到推广。
a game-theoretic principle called “revenue equivalence”: The revenue equivalence theorem originated with Vickrey, “Counterspeculation, Auctions, and Competitive Sealed Tenders” and was generalized in Myerson, “Optimal Auction Design,” and Riley and Samuelson, “Optimal Auctions.”
维克里拍卖“棒极了”: Tim Roughgarden,《算法博弈论,讲座 3(迈尔森引理)》,2013 年 10 月 2 日发布,https://www.youtube.com/watch?v =9qZwchMuslk 。
the Vickrey auction is “awesome”: Tim Roughgarden, “Algorithmic Game Theory, Lecture 3 (Myerson’s Lemma),” published October 2, 2013, https://www.youtube.com/watch?v=9qZwchMuslk.
“我认为这真的太棒了”:诺姆·尼桑,个人采访,2015 年 4 月 13 日。
“I think that’s really fantastic”: Noam Nisan, personal interview, April 13, 2015.
“你能看到最美好的事物之一”:保罗·米尔格罗姆,个人访谈,2015 年 4 月 21 日。
“one of the best things you can see”: Paul Milgrom, personal interview, April 21, 2015.
“他人即地狱”:萨特,《无路》。
“Hell is other people”: Sartre, No Exit.
结论
CONCLUSION
“学会如何和谐共处”:弗勒德,《智能机器的未来是什么?》
“to learn how to live well together”: Flood, “What Future Is There for Intelligent Machines?”
“将此定义为最 明智的 行为”:罗素,《伦理学要素》。
“define this as the wisest act”: Russell, “The Elements of Ethics.”
一种计算斯多葛主义:例如参见 Baltzly 的《斯多葛主义》。
a kind of computational Stoicism: See, e.g., Baltzly, “Stoicism.”
听歌识好歌:这也恰好是P和NP的区别。更多关于此类精彩的哲学思考,请参阅Aaronson的《相信的理由》和Wigderson的《知识、创造力与P与NP》。
knowing a good song when you hear it: It also happens to be the difference between P and NP. For more delightful philosophical ruminations of this nature, see Aaronson, “Reasons to Believe,” and Wigderson, “Knowledge, Creativity, and P versus NP.”
他们中没有人想看斗牛:像这样的场景有时被称为“阿比林悖论”;参见哈维的《阿比林悖论》。
none of them had wanted to see the bullfight: Scenarios like this one sometimes go by the name of “The Abilene Paradox”; see Harvey, “The Abilene Paradox.”
推动团队达成解决方案:蒂姆·费里斯 (Tim Ferriss) 也强调了这一点,他写道:“不要再问建议或解决方案,而是要主动提出。从小事做起。与其问别人下周什么时候见面,不如提出你的理想时间和第二选择。如果有人问‘我们去哪里吃饭?’‘我们看什么电影?’‘我们今晚做什么?’或类似的问题,不要反问‘嗯,你想做什么/什么时候/在哪里……?’,提出解决方案。停止反复讨论,做出决定。” 参见费里斯的《每周工作四小时》。
moving the group toward resolution: This point has also been made by Tim Ferriss, who writes, “Stop asking for suggestions or solutions and start proposing them. Begin with the small things. Rather than asking when someone would like to meet next week, propose your ideal times and second choices. If someone asks, ‘Where should we eat?,’ ‘What movie should we watch?,’ ‘What should we do tonight?,’ or anything similar, do not reflect it back with ‘Well, what/when/where do you want to…?’ Offer a solution. Stop the back and forth and make a decision.” See Ferriss, The 4-Hour Workweek.
提出一两个具体的建议:理想情况下,人们应该了解小组中每个人对所有选项的赋值,并根据这些赋值制定合理的决策策略。一种可能的方法是直接选择最大化所有人赋值乘积的选项——这也允许任何人通过赋值为零来否决某个选项。经济学中有一些观点认为这是一个好策略,可以追溯到约翰·纳什。参见纳什的《讨价还价问题》。
offering one or two concrete proposals: Ideally, one would want to know the values that each person in the group assigns to all the options, and adopt a reasonable policy for making a decision based on those. One potential approach is to simply select the option that maximizes the product of the values assigned by everyone—which also lets anyone veto an option by assigning it a value of zero. There are arguments from economics that this is a good strategy, going all the way back to John Nash. See Nash, “The Bargaining Problem.”
尽量减少硬币数量: Shallit,“这个国家需要的是一枚 18 美分的硬币。”
minimize the number of coins: Shallit, “What This Country Needs Is an 18¢ Piece.”
面值不雅的硬币也能找零: Lueker 在《非负整数规划中的两个NP完全问题》中指出,在某些假设下,用最少数量的硬币找零是NP难题。如果硬币以二进制或我们熟悉的十进制表示,则该结果成立,但如果以一进制(一为基数)表示,则不成立。一进制确实存在一个有效的解决方案,正如 Wright 在《找零问题》中所述。更多关于找零计算复杂度的信息,另请参阅 Kozen 和 Zaks 的《找零问题的最佳界限》。
ungainly denominations turn change-making: Lueker, “Two NP-Complete Problems in Nonnegative Integer Programming,” showed that under certain assumptions, making change with the fewest number of coins is NP-hard. This result holds if the coins are denominated in binary or the familiar base ten, but not if they are denominated in unary (base one), which does have an efficient solution, as shown in Wright, “The Change-Making Problem.” For more on the computational complexity of making change, see also Kozen and Zaks, “Optimal Bounds for the Change-Making Problem.”
设想一个大型停车场: Cassady 和 Kobza 在《一种评估停车位选择策略的概率方法》中比较了“选择一排,最近停车位 (PRCS)”和“循环 (CYC)”两种停车位搜索算法。更复杂的 CYC 包含最优停车规则,而 PRCS 则从目的地出发,指向远处,并简单地占据第一个停车位。更激进的 CYC 平均能找到更好的停车位,但更简单的 PRCS 在总耗时方面实际上更胜一筹。遵循 CYC 算法的驾驶员寻找更好停车位所花费的时间,超过了这些更好停车位为他们节省的步行时间。作者指出,此类研究可能有助于停车场的设计。Benenson、Martens 和 Birfir 等在《PARKAGENT:基于代理的城市停车模型》中也探讨了停车的计算模型。
Consider a large parking lot: Cassady and Kobza, “A Probabilistic Approach to Evaluate Strategies for Selecting a Parking Space,” compares the “Pick a Row, Closest Space (PRCS)” and “Cycling (CYC)” parking space–hunting algorithms. The more complicated CYC includes an optimal stopping rule, while PRCS starts at the destination, pointing away, and simply takes the first space. The more aggressive CYC found better spaces on average, but the simpler PRCS actually won in terms of total time spent. Drivers following the CYC algorithm spent more time finding better spaces than those better spaces saved them in walk time. The authors note that research of this nature might be useful in the design of parking lots. Computational models of parking are also explored in, e.g., Benenson, Martens, and Birfir, “PARKAGENT: An Agent-Based Model of Parking in the City.”
“旋转”和“阻挡”:为了更深入地了解何时旋转以及何时阻挡,请参阅Boguslavsky等人的“旋转和阻挡的最佳策略”。 (请注意,这与我们在第一章的一次滑水之旅中遇到的Leonid Boguslavsky是同一个人。)
“spinning” and “blocking”: For a deeper look at when to spin and when to block, see, for instance, Boguslavsky et al., “Optimal Strategies for Spinning and Blocking.” (Note that this is the same Leonid Boguslavsky we encountered briefly in chapter 1 on a water-skiing trip.)
Aaronson, Scott。“相信的理由” Shtetl-Optimized (博客),2006年9月4日。http ://www.scottaaronson.com/blog/? p=122/ 。
Aaronson, Scott. “Reasons to Believe” Shtetl-Optimized (blog), September 4, 2006. http://www.scottaaronson.com/blog/?p=122/.
______。“为什么哲学家应该关心计算复杂性。” arXiv 预印本 arXiv:1108.1791,2011年。
______. “Why Philosophers Should Care About Computational Complexity.” arXiv preprint arXiv:1108.1791, 2011.
Abramson, Norman。“ALOHA系统:计算机通信的另一种选择。”载于1970年11月17-19日秋季联合计算机会议论文集,1970年,第281-285页。
Abramson, Norman. “The ALOHA System: Another Alternative for Computer Communications.” In Proceedings of the November 17–19, 1970, Fall Joint Computer Conference, 1970, 281–285.
Ackley, David H. “超越效率”。《ACM通讯》 56卷,第10期(2013年):38-40。
Ackley, David H. “Beyond Efficiency.” Communications of the ACM 56, no. 10 (2013): 38–40.
阿格拉瓦尔、马宁德拉、尼拉吉·卡亚尔和尼廷·萨克塞纳。 “PRIMES 位于P中。”数学年鉴160 (2004): 781–793。
Agrawal, Manindra, Neeraj Kayal, and Nitin Saxena. “PRIMES Is in P.” Annals of Mathematics 160 (2004): 781–793.
Agrawal, Rajeev. “基于样本均值的O (log n )后悔函数的指数策略解决多臂老虎机问题。” 《应用概率进展》 27 (1995): 1054–1078。
Agrawal, Rajeev. “Sample Mean Based Index Policies with O(log n) Regret for the Multi-Armed Bandit Problem.” Advances in Applied Probability 27 (1995): 1054–1078.
Agrawal, Shipra 和 Navin Goyal。“多臂老虎机问题的汤普森抽样分析。”载于第25届学习理论年会论文集,2012年。
Agrawal, Shipra, and Navin Goyal. “Analysis of Thompson Sampling for the Multi-armed Bandit Problem.” In Proceedings of the 25th Annual Conference on Learning Theory, 2012.
Akerlof, George A. “忠诚度过滤器”。《美国经济评论》 1983年,54-63页。
Akerlof, George A. “Loyalty Filters.” American Economic Review 1983, 54–63.
艾伦,戴维。《搞定一切:无压力生产力的艺术》。纽约:企鹅出版社,2002年。
Allen, David. Getting Things Done: The Art of Stress-Free Productivity. New York: Penguin, 2002.
Aloupis, Greg, Erik D. Demaine 和 Alan Guo. “经典任天堂游戏 ( NP- ) 难。” arXiv 预印本 arXiv:1203.1895,2012年。
Aloupis, Greg, Erik D. Demaine, and Alan Guo. “Classic Nintendo Games Are (NP-) Hard.” arXiv preprint arXiv:1203.1895, 2012.
安永红、胡英耀和 Matthew Shum。“估算投标人数量未知的第一价格拍卖:一种错误分类方法。” 《计量经济学杂志》 157,第 2 期(2010 年):328-341。
An, Yonghong, Yingyao Hu, and Matthew Shum. “Estimating First-Price Auctions with an Unknown Number of Bidders: A Misclassification Approach.” Journal of Econometrics 157, no. 2 (2010): 328–341.
安德森,约翰·R。《思维的适应性特征》。新泽西州希尔斯代尔:埃尔鲍姆,1990年。
Anderson, John R. The Adaptive Character of Thought. Hillsdale, NJ: Erlbaum, 1990.
Anderson, John R. 和 Robert Milson。“人类记忆:一种适应性视角。” 《心理学评论》 96,第4期(1989):703–719。
Anderson, John R., and Robert Milson. “Human Memory: An Adaptive Perspective.” Psychological Review 96, no. 4 (1989): 703–719.
Anderson, John R. 和 Lael J. Schooler。“记忆中环境的反映。” 《心理科学》 2,第6期(1991):396–408。
Anderson, John R., and Lael J. Schooler. “Reflections of the Environment in Memory.” Psychological Science 2, no. 6 (1991): 396–408.
丹·艾瑞里和西蒙·琼斯。《怪诞行为学》。纽约:哈珀柯林斯出版社,2008年。
Ariely, Dan, and Simon Jones. Predictably Irrational. New York: HarperCollins, 2008.
阿伦尼乌斯,古斯塔夫。“基于弱序假设的人口价值论中的不可能定理。” 《哲学研究》 49(1999):11-21。
Arrhenius, Gustaf. “An Impossibility Theorem in Population Axiology with Weak Ordering Assumptions.” Philosophical Studies 49 (1999): 11–21.
Auer, Peter, Nicolò Cesa-Bianchi 和 Paul Fischer。“多臂老虎机问题的有限时间分析。”机器学习47 (2002): 235–256。
Auer, Peter, Nicolò Cesa-Bianchi, and Paul Fischer. “Finite-Time Analysis of the Multiarmed Bandit Problem.” Machine Learning 47 (2002): 235–256.
奥斯汀,简·爱玛。伦敦:约翰·默里,1815年。
Austen, Jane. Emma. London: John Murray, 1815.
奥地利,杰弗里·D·赫尔曼·霍勒瑞斯:被遗忘的信息处理巨人。纽约:哥伦比亚大学出版社,1982年。
Austrian, Geoffrey D. Herman Hollerith: Forgotten Giant of Information Processing. New York: Columbia University Press, 1982.
巴赫曼、保罗.分析理论。莱比锡:托伊布纳,1894 年。
Bachmann, Paul. Die analytische zahlentheorie. Leipzig: Teubner, 1894.
Badger, Lee. “Lazzarini 对π的幸运近似值。” 《数学杂志》 67 (1994): 83–91。
Badger, Lee. “Lazzarini’s Lucky Approximation of π.” Mathematics Magazine 67 (1994): 83–91.
Bailey, Arthur L.可信度程序:拉普拉斯对贝叶斯规则的推广以及间接知识与观测数据的结合。纽约:纽约州保险部,1950年。
Bailey, Arthur L. Credibility Procedures: Laplace’s Generalization of Bayes’ Rule and the Combination of Collateral Knowledge with Observed Data. New York: New York State Insurance Department, 1950.
Baker, Kenneth R.排序与调度简介。纽约: Wiley, 1974年。
Baker, Kenneth R. Introduction to Sequencing and Scheduling. New York: Wiley, 1974.
Baker, Kenneth R.、Eugene L. Lawler、Jan Karel Lenstra 和 Alexander HG Rinnooy Kan。“在发布日期和优先约束条件下,对单台机器进行抢占式调度以最小化最大成本。” 《运筹学》 31 卷,第 2 期(1983 年):381–386。
Baker, Kenneth R., Eugene L. Lawler, Jan Karel Lenstra, and Alexander H. G. Rinnooy Kan. “Preemptive Scheduling of a Single Machine to Minimize Maximum Cost Subject to Release Dates and Precedence Constraints.” Operations Research 31, no. 2 (1983): 381–386.
巴尔茨利,德克。“斯多葛主义”。摘自《斯坦福哲学百科全书》(2014年春季版)。爱德华·N·扎尔塔主编。http ://plato.stanford.edu/archives/spr2014/entries/stoicism/。
Baltzly, Dirk. “Stoicism.” In The Stanford Encyclopedia of Philosophy (spring 2014 edition). Edited by Edward N. Zalta. http://plato.stanford.edu/archives/spr2014/entries/stoicism/.
Banks, Jeffrey S. 和 Rangarajan K Sundaram。“转换成本和吉廷斯指数。” 《计量经济学》 62 (1994): 687–694。
Banks, Jeffrey S., and Rangarajan K Sundaram. “Switching Costs and the Gittins Index.” Econometrica 62 (1994): 687–694.
Barabási, Albert-László。《关联:万物如何相互关联及其对商业、科学和日常生活的意义》。纽约:企鹅出版社,2002年。
Barabási, Albert-László. Linked: How Everything Is Connected to Everything Else and What It Means for Business, Science, and Everyday Life. New York: Penguin, 2002.
Baran, Paul. “论分布式通信”。兰德公司研究文献第一至十一卷, 1964年8月,第637-648页。
Baran, Paul. “On Distributed Communications.” Volumes I–XI, RAND Corporation Research Documents, August 1964, 637–648.
巴纳德,切斯特I. 《行政职能》。马萨诸塞州剑桥:哈佛大学出版社,1938年。
Barnard, Chester I. The Functions of the Executive. Cambridge, MA: Harvard University Press, 1938.
Bartlett, Robert H., Dietrich W. Roloff, Richard G. Cornell, Alice French Andrews, Peter W. Dillon, 和 Joseph B. Zwischenberger. “新生儿呼吸衰竭的体外循环:一项前瞻性随机研究。” 《儿科学》 76卷,第4期(1985年):479–487。
Bartlett, Robert H., Dietrich W. Roloff, Richard G. Cornell, Alice French Andrews, Peter W. Dillon, and Joseph B. Zwischenberger. “Extracorporeal Circulation in Neonatal Respiratory Failure: A Prospective Randomized Study.” Pediatrics 76, no. 4 (1985): 479–487.
鲍姆加特,卡罗拉。《约翰尼斯·开普勒:生平与书信》。纽约:哲学图书馆,1951年。
Baumgardt, Carola. Johannes Kepler: Life and Letters. New York: Philosophical Library, 1951.
Bavelas, Janet B.、Linda Coates 和 Trudy Johnson。“倾听者作为共同叙述者。” 《人格与社会心理学杂志》 79,第6期(2000):941–952。
Bavelas, Janet B., Linda Coates, and Trudy Johnson. “Listeners as Co-Narrators.” Journal of Personality and Social Psychology 79, no. 6 (2000): 941–952.
贝叶斯,托马斯。“《概率学说问题求解论》。《哲学学报》 53 (1763): 370–418。
Bayes, Thomas. “An Essay Towards Solving a Problem in the Doctrine of Chances.” Philosophical Transactions 53 (1763): 370–418.
Bearden, Neil。“基于等级选择和基数支付的新秘书问题。” 《数学心理学杂志》 50 (2006): 58–59。
Bearden, Neil. “A New Secretary Problem with Rank-Based Selection and Cardinal Payoffs.” Journal of Mathematical Psychology 50 (2006): 58–59.
Bélády, Laszlo A.“虚拟存储计算机的替换算法研究。” IBM 系统杂志5 (1966): 78–101。
Bélády, Laszlo A. “A Study of Replacement Algorithms for a Virtual-Storage Computer.” IBM Systems Journal 5 (1966): 78–101.
Bélády, Laszlo A., Robert A Nelson 和 Gerald S. Shedler. “寻呼机中某些程序的时空特性异常。” 《ACM通讯》第12卷,第6期(1969年):349–353页。
Bélády, Laszlo A., Robert A Nelson, and Gerald S. Shedler. “An Anomaly in Space-Time Characteristics of Certain Programs Running in a Paging Machine.” Communications of the ACM 12, no. 6 (1969): 349–353.
Belew, Richard K.探索:从认知视角看搜索引擎技术和万维网。英国剑桥:剑桥大学出版社,2000年。
Belew, Richard K. Finding Out About: A Cognitive Perspective on Search Engine Technology and the WWW. Cambridge, UK: Cambridge University Press, 2000.
贝尔,奥布里 FG在葡萄牙。纽约:约翰巷,1912 年。
Bell, Aubrey F. G. In Portugal. New York: John Lane, 1912.
Bellhouse, David R. “托马斯·贝叶斯牧师,FRS:纪念其诞辰三百周年的传记。” 《统计科学》 19(2004):3-43。
Bellhouse, David R. “The Reverend Thomas Bayes, FRS: A Biography to Celebrate the Tercentenary of His Birth.” Statistical Science 19 (2004): 3–43.
贝尔曼,理查德。动态规划。新泽西州普林斯顿:普林斯顿大学出版社,1957年。
Bellman, Richard. Dynamic Programming. Princeton, NJ: Princeton University Press, 1957.
______ . “序贯实验设计中的一个问题。” Sankhyā:《印度统计杂志》 16 (1956): 221–229。
______. “A Problem in the Sequential Design of Experiments.” Sankhyā: The Indian Journal of Statistics 16 (1956): 221–229.
Bellows, Meghan L. 和 JD Luc Peterson。“寻找最佳座位表。”《不可思议的研究年鉴》(2012 年)。
Bellows, Meghan L., and J. D. Luc Peterson. “Finding an Optimal Seating Chart.” Annals of Improbable Research (2012).
Benenson, Itzhak, Karel Martens 和 Slava Birfir. “PARKAGENT:基于代理的城市停车模型。” 《计算机、环境与城市系统》第 32 卷,第 6 期 (2008): 431–439 页。
Benenson, Itzhak, Karel Martens, and Slava Birfir. “PARKAGENT: An Agent-Based Model of Parking in the City.” Computers, Environment and Urban Systems 32, no. 6 (2008): 431–439.
Berezovsky, Boris 和 Alexander V. Gnedin。《最佳选择问题》(俄语版)。莫斯科:Akademia Nauk,1984 年。
Berezovsky, Boris, and Alexander V. Gnedin. Problems of Best Choice (in Russian). Moscow: Akademia Nauk, 1984.
Berg-Kirkpatrick, Taylor 和 Dan Klein。“通过百万次随机重启进行解密。”《自然语言处理经验方法会议论文集》(2013):第 874-878 页。
Berg-Kirkpatrick, Taylor, and Dan Klein. “Decipherment with a Million Random Restarts.” In Proceedings of the Conference on Empirical Methods in Natural Language Processing (2013): 874–878.
Bernardo, Antonio E. 和 Ivo Welch。“论过度自信与企业家的演变。” 《经济与管理战略杂志》第10卷,第3期(2001年):301-330页。
Bernardo, Antonio E., and Ivo Welch. “On the Evolution of Overconfidence and Entrepreneurs.” Journal of Economics & Management Strategy 10, no. 3 (2001): 301–330.
Berry, Donald A.“伯努利双臂赌博机”。《数理统计年鉴》 43 (1972): 871–897。
Berry, Donald A. “A Bernoulli Two-Armed Bandit.” Annals of Mathematical Statistics 43 (1972): 871–897.
______ .“评论:伦理与ECMO。” 《统计科学》 4 (1989): 306–310。
______. “Comment: Ethics and ECMO.” Statistical Science 4 (1989): 306–310.
Berry, Donald A. 和 Bert Fristed。赌博机问题:实验的顺序分配。纽约:Chapman and Hall,1985 年。
Berry, Donald A., and Bert Fristed. Bandit Problems: Sequential Allocation of Experiments. New York: Chapman and Hall, 1985.
Bettencourt, Luís MA, José Lobo, Dirk Helbing, Christian Kühnert 和 Geoffrey B. West。“增长、创新、规模化和城市生活节奏。”《美国国家科学院院刊》 104卷,第17期(2007年):7301–7306页。
Bettencourt, Luís M. A., José Lobo, Dirk Helbing, Christian Kühnert, and Geoffrey B. West. “Growth, Innovation, Scaling, and the Pace of Life in Cities.” Proceedings of the National Academy of Sciences 104, no. 17 (2007): 7301–7306.
Bikhchandani, Sushil, David Hirshleifer 和 Ivo Welch。“信息级联下的时尚、风尚、习俗和文化变迁理论。” 《政治经济学杂志》 100,第5期(1992 年):992–1026。
Bikhchandani, Sushil, David Hirshleifer, and Ivo Welch. “A Theory of Fads, Fashion, Custom, and Cultural Change as Informational Cascades.” Journal of Political Economy 100, no. 5 (1992): 992–1026.
______ . “从他人行为中学习:从众、时尚和信息瀑布。” 《经济展望杂志》 12,第3期(1998年):151-170页。
______. “Learning from the Behavior of Others: Conformity, Fads, and Informational Cascades.” Journal of Economic Perspectives 12, no. 3 (1998): 151–170.
宾莫尔,肯。《博弈论:简介》。纽约:牛津大学出版社,2007年。
Binmore, Ken. Game Theory: A Very Short Introduction. New York: Oxford University Press, 2007.
______。自然正义。纽约:牛津大学出版社,2005年。
______. Natural Justice. New York: Oxford University Press, 2005.
Bjarnason, Ronald、Alan Fern 和 Prasad Tadepalli。“基于蒙特卡洛规划的克朗代克纸牌下限计算。”载于第19届自动规划与调度国际会议论文集(ICAPS 2009)。
Bjarnason, Ronald, Alan Fern, and Prasad Tadepalli. “Lower Bounding Klondike Solitaire with Monte-Carlo Planning.” In Proceedings of the 19th International Conference on Automated Planning and Scheduling, ICAPS 2009.
布劳,彼得·迈克尔。《官僚体制的动态:两个政府机构人际关系研究》。芝加哥:芝加哥大学出版社,1955年。
Blau, Peter Michael. The Dynamics of Bureaucracy: A Study of Interpersonal Relations in Two Government Agencies. Chicago: University of Chicago Press, 1955.
Bloom, Burton H.“允许错误情况下哈希编码的空间/时间权衡”。《ACM通讯》 13,第7期(1970年):422–426。
Bloom, Burton H. “Space/Time Trade-offs in Hash Coding with Allowable Errors.” Communications of the ACM 13, no. 7 (1970): 422–426.
Boguslavsky, Leonid, Karim Harzallah, A. Kreinen, K. Sevcik 和 Alexander Vainshtein。“旋转和阻塞的最佳策略。” 《并行和分布式计算杂志》 21,第2期(1994年):246-254。
Boguslavsky, Leonid, Karim Harzallah, A. Kreinen, K. Sevcik, and Alexander Vainshtein. “Optimal Strategies for Spinning and Blocking.” Journal of Parallel and Distributed Computing 21, no. 2 (1994): 246–254.
布尔斯廷,丹尼尔·J。《发现者:人类探索世界和自我的历史》。纽约:兰登书屋,1983年。
Boorstin, Daniel J. The Discoverers: A History of Man’s Search to Know His World and Himself. New York: Random House, 1983.
Bradt, Russell N.、SM Johnson 和 Samuel Karlin。“论最大化N 个观测值总和的序贯设计。” 《数理统计年鉴》第 27 卷 (1956): 1060–1074 页。
Bradt, Russell N., S. M. Johnson, and Samuel Karlin. “On Sequential Designs for Maximizing the Sum of N Observations.” Annals of Mathematical Statistics 27 (1956): 1060–1074.
布兰奇,约翰。“降雪:隧道溪雪崩。” 《纽约时报》,2012年12月20日。
Branch, John. “Snow Fall: The Avalanche at Tunnel Creek.” New York Times, December 20, 2012.
布朗,亚历山大·L.,乔安娜·N·拉希。《小胜利:创造储蓄和减债的内在动力》。技术报告。马萨诸塞州剑桥:美国国家经济研究局,2014年。
Brown, Alexander L., and Joanna N. Lahey. Small Victories: Creating Intrinsic Motivation in Savings and Debt Reduction. Technical report. Cambridge, MA: National Bureau of Economic Research, 2014.
Brush, Eleanor R.、David C. Krakauer 和 Jessica C. Flack。“基于网络数据计算节点状态共识的算法家族。” PLoS Computational Biology,第 9 卷,第 7 期(2013 年)。
Brush, Eleanor R., David C. Krakauer, and Jessica C. Flack. “A Family of Algorithms for Computing Consensus About Node State from Network Data.” PLoS Computational Biology 9, no. 7 (2013).
Bruss, F. Thomas。“一类具有未知选项数量的最佳选择问题的统一方法。” 《概率年鉴》 12 (1984): 882–889。
Bruss, F. Thomas. “A Unified Approach to a Class of Best Choice Problems with an Unknown Number of Options.” Annals of Probability 12 (1984): 882–889.
Buch, P.“讨论未来前景。” 《自然》 368 (1994): 107–108。
Buch, P. “Future Prospects Discussed.” Nature 368 (1994): 107–108.
布冯,乔治·路易斯·勒克莱尔伯爵。 “士气算术论文。” 《自然、一般和特别历史》补充4 (1777):46–148。
Buffon, Georges-Louis Leclerc, Comte de. “Essai d’arithmétique morale.” Supplément à l’Histoire naturelle, générale et particuliére 4 (1777): 46–148.
Burks, Arthur W., Herman H. Goldstine 和 John von Neumann。《电子计算仪器逻辑设计的初步讨论》。新泽西州普林斯顿:高等研究院,1946年。
Burks, Arthur W., Herman H. Goldstine, and John von Neumann. Preliminary Discussion of the Logical Design of an Electronic Computing Instrument. Princeton, NJ: Institute for Advanced Study, 1946.
Burrell, Quentin。“图书馆借阅的简单随机模型。” 《文献期刊》 36卷,第2期(1980年):115–132。
Burrell, Quentin. “A Simple Stochastic Model for Library Loans.” Journal of Documentation 36, no. 2 (1980): 115–132.
Burthe Jr., Ronald. “强概率素数检验的进一步研究。”美国数学学会计算数学第 65 卷,第 213 期 (1996): 373–381 页。
Burthe Jr., Ronald. “Further Investigations with the Strong Probable Prime Test.” Mathematics of Computation of the American Mathematical Society 65, no. 213 (1996): 373–381.
卡贝尔,詹姆斯·布兰奇。《银色种马》。纽约:罗伯特·M·麦克布莱德,1926年。
Cabell, James Branch. The Silver Stallion. New York: Robert M. McBride, 1926.
坎贝尔,唐纳德·T。“创造性思维中的盲目变异和选择性保留与其他知识过程一样。” 《心理学评论》 67(1960):380-400。
Campbell, Donald T. “Blind Variation and Selective Retention in Creative Thought as in Other Knowledge Processes.” Psychological Review 67 (1960): 380–400.
Carpenter, Brian 和 Robert Hinden。RFC 1149 针对 IPv6 的适配。技术报告。RFC 6214,2011 年 4 月。
Carpenter, Brian, and Robert Hinden. Adaptation of RFC 1149 for IPv6. Technical report. RFC 6214, April 2011.
卡罗尔,刘易斯。《西尔维与布鲁诺》完结篇。伦敦:麦克米伦出版社,1893年。
Carroll, Lewis. Sylvie and Bruno Concluded. London: Macmillan, 1893.
Carstensen, Laura L. “成年期的社会和情感模式:对社会情感选择性理论的支持。” 《心理学与衰老》 7 (1992): 331–338。
Carstensen, Laura L. “Social and Emotional Patterns in Adulthood: Support for Socioemotional Selectivity Theory.” Psychology and Aging 7 (1992): 331–338.
Cassady, C. Richard 和 John E. Kobza。“一种评估停车位选择策略的概率方法。” 《交通科学》 32 卷,第 1 期 (1998): 30-42。
Cassady, C. Richard, and John E. Kobza. “A Probabilistic Approach to Evaluate Strategies for Selecting a Parking Space.” Transportation Science 32, no. 1 (1998): 30–42.
罗伯特·考德雷,《字母表》,包含并教授从希伯来语、希腊语、拉丁语或法语等语言借用而来的难懂英语词汇的正确书写和理解,并附上浅显易懂的英语词汇解释。本书汇集了这些词汇,旨在帮助女士、贵妇或其他任何有经验的人士。通过本书,他们可以更轻松、更好地理解在《圣经》、《布道》或其他地方听到或读到的许多难懂英语词汇,并能够自己恰当地运用这些词汇。伦敦:埃德蒙·韦弗出版社,1604年。
Cawdrey, Robert. A Table Alphabeticall, conteyning and teaching the true writing, and vnderstanding of hard vsuall English wordes, borrowed from the Hebrew, Greeke, Latine, or French, &c. With the interpretation thereof by plaine English words, gathered for the benefit & helpe of ladies, gentlewomen, or any other vnskilfull persons. Whereby they may the more easilie and better vnderstand many hard English wordes, which they shall heare or read in Scriptures, Sermons, or elswhere, and also be made able to vse the same aptly themselues. London: Edmund Weaver, 1604.
Cayley, Arthur. “数学问题及其解答。” 《教育时报》 23 (1875): 18–19。
Cayley, Arthur. “Mathematical Questions with Their Solutions.” Educational Times 23 (1875): 18–19.
______。《亚瑟·凯莱数学论文集》 10:587–588。英国剑桥:剑桥大学出版社,1896年。
______. The Collected Mathematical Papers of Arthur Cayley 10: 587–588. Cambridge, UK: Cambridge University Press, 1896.
Cerf, Vinton G. 和 Robert E. Kahn。“分组网络互通协议。” 《IEEE 通信学报》第 22 卷,第 5 期 (1974): 637–648 页。
Cerf, Vinton G., and Robert E. Kahn. “A Protocol for Packet Network Intercommunication.” IEEE Transactions on Communications 22, no. 5 (1974): 637–648.
Chabert, Jean-Luc, Evelyne Barbin 和 Christopher John Weeks。《算法史:从鹅卵石到微芯片》。柏林:Springer,1999 年。
Chabert, Jean-Luc, Evelyne Barbin, and Christopher John Weeks. A History of Algorithms: From the Pebble to the Microchip. Berlin: Springer, 1999.
Charles, Susan T. 和 Laura L. Carstensen。“社会与情感衰老。” 《心理学年鉴》 61 (2010): 383–409。
Charles, Susan T., and Laura L. Carstensen. “Social and Emotional Aging.” Annual Review of Psychology 61 (2010): 383–409.
Chen, Stanley F. 和 Joshua Goodman。“语言建模平滑技术的实证研究。”载于《计算语言学协会第 34 届年会论文集》,1996 年,第 310-318 页。
Chen, Stanley F., and Joshua Goodman. “An Empirical Study of Smoothing Techniques for Language Modeling.” In Proceedings of the 34th Annual Meeting of the Association for Computational Linguistics, 1996, 310–318.
陈曦和邓晓铁。“解决双人纳什均衡的复杂性。” 《计算机科学基础》,2006 年,第 261-272 页。
Chen, Xi, and Xiaotie Deng. “Settling the Complexity of Two-Player Nash Equilibrium.” In Foundations of Computer Science, 2006, 261–272.
周永胜和赫伯特·罗宾斯。“鞅系统定理及其应用。”载于第四届伯克利数理统计与概率研讨会论文集。伯克利:加州大学出版社,1961年。
Chow, Y. S., and Herbert Robbins. “A Martingale System Theorem and Applications.” In Proceedings of the Fourth Berkeley Symposium on Mathematical Statistics and Probability. Berkeley: University of California Press, 1961.
______ . “论最优停止规则。” 《概率论与相关领域》2 (1963): 33–49。
______. “On Optimal Stopping Rules.” Probability Theory and Related Fields 2 (1963): 33–49.
Chow, YS, Sigaiti Moriguti, Herbert Robbins 和 SM Samuels。“基于相对等级的最优选择(“秘书问题”)。” 《以色列数学杂志》 2 (1964): 81–90。
Chow, Y. S., Sigaiti Moriguti, Herbert Robbins, and S. M. Samuels. “Optimal Selection Based on Relative Rank (the ‘Secretary Problem’).” Israel Journal of Mathematics 2 (1964): 81–90.
Christian, Brian. “A/B 测试:改变商业规则的技术内幕。” 《连线》杂志第 20 卷,第 5 期(2012 年)。
Christian, Brian. “The A/B Test: Inside the Technology That’s Changing the Rules of Business.” Wired Magazine 20, no. 5 (2012).
Christofides, Nicos。旅行商问题新启发式算法的最坏情况分析。技术报告388。匹兹堡:卡内基梅隆大学工业管理研究生院,1976年。
Christofides, Nicos. Worst-Case Analysis of a New Heuristic for the Travelling Salesman Problem. Technical report 388. Pittsburgh: Graduate School of Industrial Administration, Carnegie Mellon University, 1976.
丘吉尔,温斯顿。《温斯顿·S·丘吉尔:他的1897-1963年完整演讲集》。罗伯特·罗兹·詹姆斯主编。伦敦:切尔西出版社,1974年。
Churchill, Winston. Winston S. Churchill: His Complete Speeches, 1897–1963. Edited by Robert Rhodes James. London: Chelsea House, 1974.
西里洛、弗朗西斯科.番茄工作法。北卡罗来纳州罗利:露露,2009 年。
Cirillo, Francesco. The Pomodoro Technique. Raleigh, NC: Lulu, 2009.
Clarke, Donald D. 和 Louis Sokoloff。“脑的循环和能量代谢。”载于《基础神经化学:分子、细胞和医学方面》,第6版,由 George J. Siegel、Bernard W. Agranoff、R. Wayne Albers、Stephen K. Fisher 和 Michael D. Uhler 编辑。费城:Lippincott-Raven,1999年,第637-669页。
Clarke, Donald D., and Louis Sokoloff. “Circulation and Energy Metabolism of the Brain.” In Basic Neurochemistry: Molecular, Cellular and Medical Aspects, 6th ed., edited by George J. Siegel, Bernard W. Agranoff, R. Wayne Albers, Stephen K. Fisher, and Michael D. Uhler. Philadelphia: Lippincott-Raven, 1999, 637–669.
Clauset, Aaron, Cosma Rohilla Shalizi 和 Mark EJ Newman。“经验数据中的幂律分布。” 《SIAM Review》 51,第 4 期(2009 年):661–703。
Clauset, Aaron, Cosma Rohilla Shalizi, and Mark E. J. Newman. “Power-Law Distributions in Empirical Data.” SIAM Review 51, no. 4 (2009): 661–703.
科巴姆,艾伦。“函数的内在计算难度。”载于1964年逻辑、方法论和科学哲学大会论文集。阿姆斯特丹:北荷兰出版社,1964年。
Cobham, Alan. “The Intrinsic Computational Difficulty of Functions.” In Proceedings of the 1964 Congress on Logic, Methodology and Philosophy of Science. Amsterdam: North Holland, 1964.
柯南·道尔,亚瑟。《血字的研究:约翰·H·华生的回忆录》。载于《比顿圣诞年鉴》,第29卷。伦敦:沃德·洛克出版社,1887年。
Conan Doyle, Arthur. “A Study in Scarlet: The Reminiscences of John H. Watson.” In Beeton’s Christmas Annual, vol. 29. London: Ward, Lock, 1887.
康纳,詹姆斯·A·开普勒的女巫:一位天文学家在宗教战争、政治阴谋和母亲异端审判中发现宇宙秩序。纽约:哈珀柯林斯出版社,2004年。
Connor, James A. Kepler’s Witch: An Astronomer’s Discovery of Cosmic Order Amid Religious War, Political Intrigue, and the Heresy Trial of His Mother. New York: HarperCollins, 2004.
Conti, Carl J.、Donald H. Gibson 和 Stanley H. Pitkowsky。“System/360 模型 85 的结构方面 I:一般组织。” 《IBM 系统期刊》 7 (1968): 2-14。
Conti, Carl J., Donald H. Gibson, and Stanley H. Pitkowsky. “Structural Aspects of the System/360 Model 85, I: General Organization.” IBM Systems Journal 7 (1968): 2–14.
Cook, Stephen A.,“定理证明程序的复杂性”。载于第三届ACM计算理论研讨会论文集,1971年,第151-158页。
Cook, Stephen A. “The Complexity of Theorem-Proving Procedures.” In Proceedings of the Third Annual ACM Symposium on Theory of Computing, 1971, 151–158.
库克,威廉。《追寻旅行推销员:计算极限的数学》。新泽西州普林斯顿:普林斯顿大学出版社,2012年。
Cook, William. In Pursuit of the Traveling Salesman: Mathematics at the Limits of Computation. Princeton, NJ: Princeton University Press, 2012.
柯维,史蒂芬·R。《如何成功与人相处》。盐湖城:影山出版社,1971年。
Covey, Stephen R. How to Succeed with People. Salt Lake City: Shadow Mountain, 1971.
Craig, JV,《鸡的攻击性行为:社会和物理环境的一些影响》。发表于1978年5月11日在密苏里州堪萨斯城举行的第27届全国育种者圆桌会议。
Craig, J. V. Aggressive Behavior of Chickens: Some Effects of Social and Physical Environments. Presented at the 27th Annual National Breeder’s Roundtable, May 11, Kansas City, MO, 1978.
Dale, Andrew I.逆概率史:从托马斯·贝叶斯到卡尔·皮尔逊。纽约:Springer,1999。
Dale, Andrew I. A History of Inverse Probability: From Thomas Bayes to Karl Pearson. New York: Springer, 1999.
戴利,劳埃德·W。《古代和中世纪字母表化史贡献》。布鲁塞尔:Latomus,1967 年。
Daly, Lloyd W. Contributions to a History of Alphabetization in Antiquity and the Middle Ages. Brussels: Latomus, 1967.
Damgård, Ivan, Peter Landrock 和 Carl Pomerance. “强概率素数检验的平均误差估计。” 《计算数学》 61,第 203 期 (1993): 177–194。
Damgård, Ivan, Peter Landrock, and Carl Pomerance. “Average Case Error Estimates for the Strong Probable Prime Test.” Mathematics of Computation 61, no. 203 (1993): 177–194.
Daniels, Bryan C., David C. Krakauer 和 Jessica C. Flack. “灵长类社会中的稀疏冲突编码”。《美国国家科学院院刊》 109卷,第35期(2012年):14259–14264。
Daniels, Bryan C., David C. Krakauer, and Jessica C. Flack. “Sparse Code of Conflict in a Primate Society.” Proceedings of the National Academy of Sciences 109, no. 35 (2012): 14259–14264.
达尔文,查尔斯。《查尔斯·达尔文通信集》,第二卷:1837-1843。弗雷德里克·伯克哈特和悉尼·史密斯主编。英国剑桥:剑桥大学出版社,1987年。
Darwin, Charles. The Correspondence of Charles Darwin, Volume 2: 1837–1843. Edited by Frederick Burkhardt and Sydney Smith. Cambridge, UK: Cambridge University Press, 1987.
Daskalakis, Constantinos, Paul W. Goldberg 和 Christos H. Papadimitriou。“计算纳什均衡的复杂性。” ACM 计算理论研讨会, 2006 年,第 71-78 页。
Daskalakis, Constantinos, Paul W. Goldberg, and Christos H. Papadimitriou. “The Complexity of Computing a Nash Equilibrium.” ACM Symposium on Theory of Computing, 2006, 71–78.
______ . “计算纳什均衡的复杂性。” SIAM 计算杂志39,第 1 期 (2009): 195–259。
______. “The Complexity of Computing a Nash Equilibrium.” SIAM Journal on Computing 39, no. 1 (2009): 195–259.
戴维斯,莉迪亚。《几乎没有记忆:故事集》。纽约:法拉,斯特劳斯和吉鲁出版社,1997年。
Davis, Lydia. Almost No Memory: Stories. New York: Farrar, Straus & Giroux, 1997.
道金斯,理查德。《进化的证据:地球上最伟大的表演》。纽约:自由出版社,2009年。
Dawkins, Richard. The Evidence for Evolution, the Greatest Show on Earth. New York: Free Press, 2009.
DeDeo, Simon、David C. Krakauer 和 Jessica C. Flack。“集体冲突动态中的战略周期性证据。” 《皇家学会界面期刊》,2011 年。
DeDeo, Simon, David C. Krakauer, and Jessica C. Flack. “Evidence of Strategic Periodicities in Collective Conflict Dynamics.” Journal of The Royal Society Interface, 2011.
DeGroot, Morris H.最优统计决策。纽约: McGraw-Hill, 1970。
DeGroot, Morris H. Optimal Statistical Decisions. New York: McGraw-Hill, 1970.
Demaine, Erik D.、Susan Hohenberger 和 David Liben-Nowell。“俄罗斯方块很难,甚至难以模拟。” 《计算与组合学》,第 351–363 页。纽约:Springer,2003 年。
Demaine, Erik D., Susan Hohenberger, and David Liben-Nowell. “Tetris Is Hard, Even to Approximate.” In Computing and Combinatorics, 351–363. New York: Springer, 2003.
DeMillo, Richard A. 和 Richard J. Lipton. “代数程序测试的概率评论。” 《信息处理快报》 7, no. 4 (1978): 193–195。
DeMillo, Richard A., and Richard J. Lipton. “A Probabilistic Remark on Algebraic Program Testing.” Information Processing Letters 7, no. 4 (1978): 193–195.
Denning, Peter J. “Thrashing:其原因与预防。”载于1968年12月9日至11日秋季联合计算机会议论文集第一部分,1968年,第915–922页。
Denning, Peter J. “Thrashing: Its Causes and Prevention.” In Proceedings of the December 9–11, 1968, Fall Joint Computer Conference, Part I, 1968, 915–922.
Diffie, Whitfield 和 Martin E. Hellman。“密码学的新方向。” 《信息理论》,IEEE 期刊第22 卷,第 6 期 (1976): 644–654 页。
Diffie, Whitfield, and Martin E. Hellman. “New Directions in Cryptography.” Information Theory, IEEE Transactions on 22, no. 6 (1976): 644–654.
迪拉德,安妮。《听客溪的朝圣者》。纽约:哈泼杂志出版社,1974年。
Dillard, Annie. Pilgrim at Tinker Creek. New York: Harper’s Magazine Press, 1974.
______。《写作人生》。纽约:Harper & Row,1989年。
______. The Writing Life. New York: Harper & Row, 1989.
查尔斯·路特维奇·道奇森。“草地网球锦标赛:正确的奖金分配方法及其谬误证明。” 《圣詹姆斯公报》,1883年8月1日:5-6页。
Dodgson, Charles Lutwidge. “Lawn Tennis Tournaments: The True Method of Assigning Prizes with a Proof of the Fallacy of the Present Method.” St. James’s Gazette, August 1, 1883: 5–6.
杜兰特,威尔。《哲学的故事:伟大哲学家的生活和观点》。纽约:西蒙与舒斯特出版社,1924年。
Durant, Will. The Story of Philosophy: The Lives and Opinions of the Greater Philosophers. New York: Simon & Schuster, 1924.
Edmonds, Jack. “最佳分支。”《美国国家标准局研究杂志》 71B,第4期 (1967): 233–240。
Edmonds, Jack. “Optimum Branchings.” Journal of Research of the National Bureau of Standards 71B, no. 4 (1967): 233–240.
______ . “道路、树木和花朵”。《加拿大数学杂志》 17,第3期(1965年):449-467。
______. “Paths, Trees, and Flowers.” Canadian Journal of Mathematics 17, no. 3 (1965): 449–467.
Erlang, Agner Krarup。“自动电话交换机中重要性概率理论中一些问题的解决方案。” Elektrotkeknikeren 13 (1917): 5-13。
Erlang, Agner Krarup. “Solution of Some Problems in the Theory of Probabilities of Significance in Automatic Telephone Exchanges.” Elektrotkeknikeren 13 (1917): 5–13.
______ . “概率论与电话交谈。” 《新数学杂志》B卷20,第33–39期(1909年):16。
______. “The Theory of Probabilities and Telephone Conversations.” Nyt Tidsskrift for Matematik B 20, nos. 33–39 (1909): 16.
埃弗里特三世,休。“用广义拉格朗日乘数法解决资源最优配置问题。” 《运筹学》 11卷,第3期(1963年):399–417页。
Everett III, Hugh. “Generalized Lagrange Multiplier Method for Solving Problems of Optimum Allocation of Resources.” Operations Research 11, no. 3 (1963): 399–417.
Feldman, Dorian。“对‘双臂老虎机’问题的贡献。” 《数理统计年鉴》第 33 卷 (1962): 847–856 页。
Feldman, Dorian. “Contributions to the ‘Two-Armed Bandit’ Problem.” Annals of Mathematical Statistics 33 (1962): 847–856.
Ferguson, Thomas S.最优停止及其应用。网址:http://www.math.ucla.edu/~tom/Stopping/。
Ferguson, Thomas S. Optimal Stopping and Applications. Available at http://www.math.ucla.edu/~tom/Stopping/.
______ . “在成功运行期间停止求和。” 《统计年鉴》 4 (1976): 252–264。
______. “Stopping a Sum During a Success Run.” Annals of Statistics 4 (1976): 252–264.
______ “谁解决了秘书问题?” 《统计科学》 4 (1989): 282–289。
______. “Who Solved the Secretary Problem?” Statistical Science 4 (1989): 282–289.
Ferguson, Thomas S., Janis P. Hardwick 和 Mitsushi Tamaki。“最大化拥有相对最佳物品的持续时间。”载于《实时顺序搜索与选择策略》,第 37-57 页。普罗维登斯:美国数学学会,1992 年。
Ferguson, Thomas S., Janis P. Hardwick, and Mitsushi Tamaki. “Maximizing the Duration of Owning a Relatively Best Object.” In Strategies for Sequential Search and Selection in Real Time, 37–57. Providence: American Mathematical Society, 1992.
费里斯,蒂莫西。《每周工作4小时》。纽约:皇冠出版社,2007年。
Ferriss, Timothy. The 4-Hour Workweek. New York: Crown, 2007.
Fiore, Neil A. 《当下习惯:克服拖延症和享受无负罪感玩乐的战略计划》。纽约:企鹅出版社,2007年。
Fiore, Neil A. The Now Habit: A Strategic Program for Overcoming Procrastination and Enjoying Guilt-Free Play. New York: Penguin, 2007.
Fisher, Marshall L.,“拉格朗日松弛法解决整数规划问题。” 《管理科学》 27,第1期(1981年):1-18。
Fisher, Marshall L. “The Lagrangian Relaxation Method for Solving Integer Programming Problems.” Management Science 27, no. 1 (1981): 1–18.
菲茨杰拉德,F·斯科特。《崩溃》。《Esquire 》第5卷,第2-4期(1936年)。
Fitzgerald, F. Scott. “The Crack-Up.” Esquire 5, nos. 2–4 (1936).
______。《崩溃》及其他未收集的片段。纽约:新方向出版社,1956年。
______. The Crack-Up with Other Uncollected Pieces. New York: New Directions, 1956.
Flood, Merrill M.“软新闻”。Datamation 30,第20期(1984):15-16。
Flood, Merrill M. “Soft News.” Datamation 30, no. 20 (1984): 15–16.
______ . “一些实验性游戏。”载于研究备忘录 RM-789。加州圣莫尼卡:兰德公司,1952 年。
______. “Some Experimental Games.” In Research Memorandum RM-789. Santa Monica, CA: RAND, 1952.
______ . “旅行商问题。” 《运筹学》 4,第1期(1956年):61-75。
______. “The Traveling-Salesman Problem.” Operations Research 4, no. 1 (1956): 61–75.
______ “智能机器的未来是什么?” 《视听通信评论》第 11 卷,第 6 期(1963 年):260-270 页。
______. “What Future Is There for Intelligent Machines?” Audio Visual Communication Review 11, no. 6 (1963): 260–270.
福斯特,爱德华·M。《霍华德庄园》。伦敦:爱德华·阿诺德,1910年。
Forster, Edward M. Howards End. London: Edward Arnold, 1910.
Fortnow, Lance. 《金票:P、NP与对不可能的探索》。新泽西州普林斯顿:普林斯顿大学出版社,2013年。
Fortnow, Lance. The Golden Ticket: P, NP, and the Search for the Impossible. Princeton, NJ: Princeton University Press, 2013.
Fraker, Guy C. “真实的林肯公路:被遗忘的林肯赛道标记。” 《亚伯拉罕·林肯协会期刊》 25 (2004): 76–97。
Fraker, Guy C. “The Real Lincoln Highway: The Forgotten Lincoln Circuit Markers.” Journal of the Abraham Lincoln Association 25 (2004): 76–97.
弗兰克,罗伯特 H.“如果经济人可以选择自己的效用函数,他会想要一个有良知的效用函数吗?”美国经济评论1987,593–604。
Frank, Robert H. “If Homo Economicus Could Choose His Own Utility Function, Would He Want One with a Conscience?” American Economic Review 1987, 593–604.
______。理性中的激情:情感的战略作用。纽约:诺顿,1988年。
______. Passions within Reason: The Strategic Role of the Emotions. New York: Norton, 1988.
Fredrickson, Barbara L. 和 Laura L. Carstensen。“选择社交伙伴:年老和预期结局如何使人们更具选择性。” 《心理学与衰老》 5 (1990): 335–347。
Fredrickson, Barbara L., and Laura L. Carstensen. “Choosing Social Partners: How Old Age and Anticipated Endings Make People More Selective.” Psychology and Aging 5 (1990): 335–347.
Freeman, PR,“秘书问题及其扩展:回顾”。《国际统计评论》 51 (1983): 189–206。
Freeman, P. R. “The Secretary Problem and Its Extensions: A Review.” International Statistical Review 51 (1983): 189–206.
Fung, Helene H.、Laura L. Carstensen 和 Amy M. Lutz。“时间对社会偏好的影响:对终身发展的影响。” 《心理学与衰老》 14 (1999): 595–604。
Fung, Helene H., Laura L. Carstensen, and Amy M. Lutz. “Influence of Time on Social Preferences: Implications for Life-Span Development.” Psychology and Aging 14 (1999): 595–604.
Gal, David 和 Blakeley B. McShane。“小胜利能否助您赢得战争?来自消费者债务管理的证据。” 《市场营销研究杂志》 49 (2012): 487–501。
Gal, David, and Blakeley B. McShane. “Can Small Victories Help Win the War? Evidence from Consumer Debt Management.” Journal of Marketing Research 49 (2012): 487–501.
Gallagher, P. 和 C. Kerry。数字签名标准。FIPS PUB 186-4,2013 年。
Gallagher, P., and C. Kerry. Digital Signature Standard. FIPS PUB 186-4, 2013.
Garey, Michael R. 和 David S. Johnson。计算机与难解性:NP 完全性指南。纽约:WH Freeman,1979 年。
Garey, Michael R., and David S. Johnson. Computers and Intractability: A Guide to NP-Completeness. New York: W. H. Freeman, 1979.
尤金·加菲尔德。“认识机遇的作用。” 《科学家》 2,第8期(1988年):10。
Garfield, Eugene. “Recognizing the Role of Chance.” Scientist 2, no. 8 (1988): 10.
Garrett, AJM 和 P. Coles。“贝叶斯归纳推理与人择宇宙学原理。” 《天体物理学评论》 17 (1993): 23-47。
Garrett, A. J. M., and P. Coles. “Bayesian Inductive Inference and the Anthropic Cosmological Principle.” Comments on Astrophysics. 17 (1993): 23–47.
Gasarch, William I. “ P =?NP民意调查。” SIGACT News 33,第2期(2002年):34-47。
Gasarch, William I. “The P =? NP Poll.” SIGACT News 33, no. 2 (2002): 34–47.
Gauthier, David P. 《道德协议》。纽约:牛津大学出版社,1985年。
Gauthier, David P. Morals by Agreement. New York: Oxford University Press, 1985.
Geman, Stuart, Elie Bienenstock 和 René Doursat。“神经网络与偏差/方差困境。” 《神经计算》 4 卷,第 1 期 (1992):1-58 页。
Geman, Stuart, Elie Bienenstock, and René Doursat. “Neural Networks and the Bias/Variance Dilemma.” Neural Computation 4, no. 1 (1992): 1–58.
Geoffrion, Arthur M.“整数规划的拉格朗日松弛法”。《数学规划研究》2 (1974): 82–114。
Geoffrion, Arthur M. “Lagrangean Relaxation for Integer Programming.” Mathematical Programming Study 2 (1974): 82–114.
______ . “整数规划的拉格朗日松弛法。”摘自《整数规划50年:1958–2008:从早期到最先进》。由Michael Juenger、Thomas M. Liebling、Denis Naddef、George L. Nemhauser、William R. Pulleyblank、Gerhard Reinelt、Giovanni Rinaldi和Laurence A. Wolsey编辑。柏林:Springer,2010年,第243–281页。
______. “Lagrangian Relaxation for Integer Programming.” In 50 Years of Integer Programming 1958–2008: From Early Years to State of the Art. Edited by Michael Juenger, Thomas M. Liebling, Denis Naddef, George L. Nemhauser, William R. Pulleyblank, Gerhard Reinelt, Giovanni Rinaldi, and Laurence A. Wolsey. Berlin: Springer, 2010, 243–281.
Gigerenzer, Gerd 和 Henry Brighton。“启发式人:为何有偏见的思维能做出更好的推理。” 《认知科学专题》 1,第1期(2009):107–143。
Gigerenzer, Gerd, and Henry Brighton. “Homo Heuristicus: Why Biased Minds Make Better Inferences.” Topics in Cognitive Science 1, no. 1 (2009): 107–143.
吉尔伯特,丹尼尔。《偶然发现的幸福》。纽约:克诺夫出版社,2006年。
Gilbert, Daniel. Stumbling on Happiness. New York: Knopf, 2006.
Gilbert, John P. 和 Frederick Mosteller。“识别序列的最大值。” 《美国统计协会杂志》第 61 卷 (1966): 35-75 页。
Gilbert, John P. and Frederick Mosteller. “Recognizing the Maximum of a Sequence.” Journal of the American Statistical Association 61 (1966): 35–75.
Gilboa, Itzhak 和 Eitan Zemel。“纳什均衡与相关均衡:一些复杂性考量。” 《博弈与经济行为》 1989 年第 1 期,第 80-93 页。
Gilboa, Itzhak, and Eitan Zemel. “Nash and Correlated Equilibria: Some Complexity Considerations.” Games and Economic Behavior 1, no. 1 (1989): 80–93.
吉利斯皮,查尔斯·库尔斯顿。皮埃尔-西蒙·拉普拉斯,1749–1827:精确科学生涯。新泽西州普林斯顿:普林斯顿大学出版社,2000年。
Gillispie, Charles Coulston. Pierre-Simon Laplace, 1749–1827: A Life in Exact Science. Princeton, NJ: Princeton University Press, 2000.
Gilmore, Paul C. 和 Ralph E. Gomory。“用线性规划方法求解下料问题(第二部分)。” 《运筹学》 11,第6期 (1963): 863–888。
Gilmore, Paul C., and Ralph E. Gomory. “A Linear Programming Approach to the Cutting Stock Problem, Part II.” Operations Research 11, no. 6 (1963): 863–888.
Gilovich, Thomas.我们如何知道并非如此。纽约:西蒙与舒斯特出版社,2008年。
Gilovich, Thomas. How We Know What Isn’t So. New York: Simon & Schuster, 2008.
金斯伯格,艾伦。《嚎叫及其他诗歌》。旧金山:城市之光出版社,1956年。
Ginsberg, Allen. Howl and Other Poems. San Francisco: City Lights Books, 1956.
Gittins, John C. “Bandit 过程和动态分配指数”。《皇家统计学会杂志》,B 系列(方法论) 41 (1979): 148–177。
Gittins, John C. “Bandit Processes and Dynamic Allocation Indices.” Journal of the Royal Statistical Society, Series B (Methodological) 41 (1979): 148–177.
Gittins, John C.、Kevin Glazebrook 和 Richard Weber。《多臂老虎机配置指数》,第二版。英国奇切斯特:Wiley,2011 年。
Gittins, John C., Kevin Glazebrook, and Richard Weber. Multi-Armed Bandit Allocation Indices, 2nd ed. Chichester, UK: Wiley, 2011.
Gittins, John C. 和 D. Jones。“序贯实验设计的动态分配指数。” 《统计学进展》。阿姆斯特丹:北荷兰,1974 年,第 241-266 页。
Gittins, John C., and D. Jones. “A Dynamic Allocation Index for the Sequential Design of Experiments.” In Progress in Statistics. Amsterdam: North Holland, 1974, 241–266.
格拉斯纳,巴里。“恐惧贩卖的叙事技巧。” 《社会研究》 71(2004):819–826。
Glassner, Barry. “Narrative Techniques of Fear Mongering.” Social Research 71 (2004): 819–826.
Goldberg, Paul W. 和 Christos H. Papadimitriou。“平衡问题之间的可约性。” ACM 计算理论研讨会2006,第 62-70 页。
Goldberg, Paul W., and Christos H. Papadimitriou. “Reducibility Between Equilibrium Problems.” ACM Symposium on Theory of Computing 2006, 62–70.
欧文·约翰·古德。《好思维:概率论基础及其应用》。明尼阿波利斯,明尼苏达州:明尼苏达大学出版社,1983年。
Good, Irving John. Good Thinking: The Foundations of Probability and Its Applications. Minneapolis, MN: University of Minnesota Press, 1983.
Gopnik, Alison、Andrew N. Meltzoff 和 Patricia K. Kuhl。《婴儿床里的科学家》。纽约:Morrow,1999 年。
Gopnik, Alison, Andrew N. Meltzoff, and Patricia K. Kuhl. The Scientist in the Crib. New York: Morrow, 1999.
Gordon, Deborah M. “无等级制的控制。” 《自然》 446,第7132期(2007年):143。
Gordon, Deborah M. “Control Without Hierarchy.” Nature 446, no. 7132 (2007): 143.
Gott,JR,“未来前景探讨”。《自然》 368(1994):108。
Gott, J. R. “Future Prospects Discussed.” Nature 368 (1994): 108.
______。“哥白尼原理对我们未来前景的启示。” 《自然》 363(1993):315-319。
______. “Implications of the Copernican Principle for Our Future Prospects.” Nature 363 (1993): 315–319.
古尔德,斯蒂芬·杰伊。“中位数并非信息。” 《发现》杂志6卷,第6期(1985年):40–42。
Gould, Stephen Jay. “The Median Isn’t the Message.” Discover 6, no. 6 (1985): 40–42.
Graham, Ronald L., Eugene L. Lawler, Jan Karel Lenstra 和 Alexander HG Rinnooy Kan. “确定性排序与调度中的优化与近似:综述”。离散数学年鉴5 (1979): 287–326。
Graham, Ronald L., Eugene L. Lawler, Jan Karel Lenstra, and Alexander H. G. Rinnooy Kan. “Optimization and Approximation in Deterministic Sequencing and Scheduling: A Survey.” Annals of Discrete Mathematics 5 (1979): 287–326.
格林纳德、乌尔夫. “随机过程的经验谱分析。” Arkiv for Matematik 1,编号。 6(1952):503-531。
Grenander, Ulf. “On Empirical Spectral Analysis of Stochastic Processes.” Arkiv för Matematik 1, no. 6 (1952): 503–531.
Gridgeman,T.“几何概率和数字π。” Scripta Mathematika 25,第3期(1960年):183-195。
Gridgeman, T. “Geometric Probability and the Number π.” Scripta Mathematika 25, no. 3 (1960): 183–195.
Griffiths, Thomas L.、Charles Kemp 和 Joshua B. Tenenbaum。“贝叶斯认知模型”。载于《剑桥计算认知模型手册》。Ron Sun 主编。英国剑桥:剑桥大学出版社,2008 年。
Griffiths, Thomas L., Charles Kemp, and Joshua B. Tenenbaum. “Bayesian Models of Cognition.” In The Cambridge Handbook of Computational Cognitive Modeling. Edited by Ron Sun. Cambridge, UK: Cambridge University Press, 2008.
Griffiths, Thomas L.、Falk Lieder 和 Noah D. Goodman。“认知资源的合理利用:计算与算法之间的分析层次。” 《认知科学专题》 7 (2015): 217–229。
Griffiths, Thomas L., Falk Lieder, and Noah D. Goodman. “Rational Use of Cognitive Resources: Levels of Analysis Between the Computational and the Algorithmic.” Topics in Cognitive Science 7 (2015): 217–229.
Griffiths, Thomas L., David M. Sobel, Joshua B. Tenenbaum 和 Alison Gopnik。“贝叶斯和布利克特:知识对儿童和成人因果归纳的影响。” 《认知科学》 35 (2011): 1407–1455。
Griffiths, Thomas L., David M. Sobel, Joshua B. Tenenbaum, and Alison Gopnik. “Bayes and Blickets: Effects of Knowledge on Causal Induction in Children and Adults.” Cognitive Science 35 (2011): 1407–1455.
Griffiths, Thomas L.、Mark Steyvers 和 Alana Firl。“Google 与思维:利用 PageRank 预测流畅度。” 《心理科学》 18(2007):1069–1076。
Griffiths, Thomas L., Mark Steyvers, and Alana Firl. “Google and the Mind: Predicting Fluency with PageRank.” Psychological Science 18 (2007): 1069–1076.
Griffiths, Thomas L. 和 Joshua B. Tenenbaum。“日常认知中的最佳预测。” 《心理科学》 17 (2006): 767–773。
Griffiths, Thomas L., and Joshua B. Tenenbaum. “Optimal Predictions in Everyday Cognition.” Psychological Science 17 (2006): 767–773.
Grossman, Dave 和 LW Christensen。《论战斗》。伊利诺斯州贝尔维尔:PPCT 研究出版社,2004 年。
Grossman, Dave, and L. W. Christensen. On Combat. Belleville, IL: PPCT Research Publications, 2004.
Haggstrom, Gus W.“需要多次停留时的最佳顺序程序。”数理统计年鉴38 (1967): 1618–1626。
Haggstrom, Gus W. “Optimal Sequential Procedures When More Than One Stop Is Required.” Annals of Mathematical Statistics 38 (1967): 1618–1626.
Halevy, Alon, Peter Norvig 和 Fernando Pereira. “数据的不合理有效性。” 《智能系统》,IEEE 24,第 2 期(2009 年):8-12。
Halevy, Alon, Peter Norvig, and Fernando Pereira. “The Unreasonable Effectiveness of Data.” Intelligent Systems, IEEE 24, no. 2 (2009): 8–12.
加勒特·哈丁。“公地悲剧”。《科学》 162卷,第3859期(1968年):1243–1248页。
Hardin, Garrett. “The Tragedy of the Commons.” Science 162, no. 3859 (1968): 1243–1248.
哈代,GH全集。第二卷。英国牛津:牛津大学出版社,1967年。
Hardy, G. H. Collected Works. Vol. II. Oxford, UK: Oxford University Press, 1967.
______ . “素数。”英国协会报告10 (1915): 350–354。
______. “Prime Numbers.” British Association Report 10 (1915): 350–354.
哈门伯格,J.重剑2.0:新击剑范式的诞生。纽约:SKA剑术出版社,2007年。
Harmenberg, J. Epee 2.0: The Birth of the New Fencing Paradigm. New York: SKA Swordplay Books, 2007.
Harsanyi, John C. “马克西姆最小原则能作为道德的基础吗?对约翰·罗尔斯理论的批判。” 《美国政治科学评论》 69,第2期(1975年):594–606。
Harsanyi, John C. “Can the Maximin Principle Serve as a Basis for Morality? A Critique of John Rawls’s Theory.” The American Political Science Review 69, no. 2 (1975): 594–606.
Harvey, Jerry B. “阿比林悖论:协议的管理。” 《组织动力学》 3,第1期(1974年):63-80。
Harvey, Jerry B. “The Abilene Paradox: The Management of Agreement.” Organizational Dynamics 3, no. 1 (1974): 63–80.
Hastings, WK,“利用马尔可夫链的蒙特卡罗方法及其应用。” Biometrika 57 (1970): 97–109。
Hastings, W. K. “Monte Carlo Methods Using Markov Chains and Their Applications.” Biometrika 57 (1970): 97–109.
Hawken, Angela 和 Mark Kleiman。《以迅速而确定的制裁措施管理涉毒缓刑犯:评估夏威夷的 HOPE 计划》。已提交至国家司法研究所的报告。2009年。http://www.ncjrs.gov/pdffiles1/nij/grants/229023.pdf。
Hawken, Angela, and Mark Kleiman. Managing Drug Involved Probationers with Swift and Certain Sanctions: Evaluating Hawaii’s HOPE. Report submitted to the National Institute of Justice. 2009. http://www.ncjrs.gov/pdffiles1/nij/grants/229023.pdf.
Held, Michael 和 Richard M. Karp。“旅行商问题与最小生成树。” 《运筹学》 18 卷,第 6 期 (1970): 1138–1162 页。
Held, Michael, and Richard M. Karp. “The Traveling-Salesman Problem and Minimum Spanning Trees.” Operations Research 18, no. 6 (1970): 1138–1162.
______ . “旅行商问题与最小生成树:第二部分。” 《数学规划》 1,第1期(1971年):6-25。
______. “The Traveling-Salesman Problem and Minimum Spanning Trees: Part II.” Mathematical Programming 1, no. 1 (1971): 6–25.
亨德森,T.离散放松技巧。英国牛津:牛津大学出版社,1989年。
Henderson, T. Discrete Relaxation Techniques. Oxford, UK: Oxford University Press, 1989.
Hennessy, John L. 和 David A. Patterson。计算机架构:一种定量方法。纽约:爱思唯尔,2012 年。
Hennessy, John L., and David A. Patterson. Computer Architecture: A Quantitative Approach. New York: Elsevier, 2012.
Herrmann, Jeffrey W.“泰勒、甘特和约翰逊的观点:如何改进生产调度。”国际运营与质量管理杂志16 (2010): 243–254。
Herrmann, Jeffrey W. “The Perspectives of Taylor, Gantt, and Johnson: How to Improve Production Scheduling.” International Journal of Operations and Quality Management 16 (2010): 243–254.
Heyde, CC,“Agner Krarup Erlang”。载于《世纪统计学家》。CC Heyde、E. Seneta、P. Crepel、SE Fienberg 和 J. Gani 编辑,第 328–330 页。纽约:Springer,2001 年。
Heyde, C. C. “Agner Krarup Erlang.” In Statisticians of the Centuries. Edited by C. C. Heyde, E. Seneta, P. Crepel, S. E. Fienberg, and J. Gani, 328–330. New York: Springer, 2001.
Hill, Theodore. “知己知彼,百战不殆。” 《美国科学家》 97 (2009): 126–131.
Hill, Theodore. “Knowing When to Stop.” American Scientist 97 (2009): 126–131.
Hillis, W. Daniel. 《石头上的图案:让计算机运转起来的简单想法》。纽约:Basic Books出版社,1998年。
Hillis, W. Daniel. The Pattern on the Stone: The Simple Ideas That Make Computers Work. New York: Basic Books, 1998.
Hirshleifer, Jack. “论情绪作为威胁与承诺的保证。”摘自《论最新之最:进化与最优性论文集》。John Dupre 主编,第 307–326 页。马萨诸塞州剑桥:麻省理工学院出版社,1987 年出版。
Hirshleifer, Jack. “On the Emotions as Guarantors of Threats and Promises.” In The Latest on the Best: Essays in Evolution and Optimality. Edited by John Dupre, 307–326. Cambridge, MA: MIT Press, 1987.
霍夫曼,大卫。《寡头:新俄罗斯的财富与权力》。纽约:公共事务出版社,2003年。
Hoffman, David. The Oligarchs: Wealth and Power in the New Russia. New York: PublicAffairs, 2003.
Horvitz, Eric 和 Shlomo Zilberstein。“有限资源下的计算权衡。” 《人工智能》 126 (2001): 1-4。
Horvitz, Eric, and Shlomo Zilberstein. “Computational Tradeoffs Under Bounded Resources.” Artificial Intelligence 126 (2001): 1–4.
Hosken, James C. “排序方法的评估”。载于1955年11月7日至9日东部联合AIEE-IRE计算机会议:商业和工业系统中的计算机的论文和讨论,第39-55页。
Hosken, James C. “Evaluation of Sorting Methods.” In Papers and Discussions Presented at the November 7–9, 1955, Eastern Joint AIEE-IRE Computer Conference: Computers in Business and Industrial Systems, 39–55.
Hurd, Cuthbert C.“早期蒙特卡罗计算和科学会议简报”。IEEE计算史年鉴7,第 2 期 (1985): 141–155。
Hurd, Cuthbert C. “A Note on Early Monte Carlo Computations and Scientific Meetings.” IEEE Annals of the History of Computing 7, no. 2 (1985): 141–155.
Impagliazzo, Russell 和 Avi Wigderson。“若E需要指数电路,则P = BPP :异或引理的去随机化。”载于第 29 届 ACM 计算理论研讨会论文集,1997 年,第 220–229 页。
Impagliazzo, Russell, and Avi Wigderson. “P = BPP if E Requires Exponential Circuits: Derandomizing the XOR Lemma.” In Proceedings of the Twenty-Ninth Annual ACM Symposium on Theory of Computing, 1997, 220–229.
______ . “随机性与时间:统一假设下的去随机化。”载于第 39 届计算机科学基础年会论文集,1998 年,734–743 页。
______. “Randomness vs. Time: De-Randomization Under a Uniform Assumption.” In Proceedings of the 39th Annual Symposium on Foundations of Computer Science, 1998, 734–743.
Ingram, Wendy Marie, Leeanne M. Goodrich, Ellen A. Robey 和 Michael B. Eisen。“感染低毒力弓形虫菌株的小鼠即使在广泛清除寄生虫后仍会失去对猫尿的先天厌恶感。” PLOS ONE,第9期(2013年):e75246。
Ingram, Wendy Marie, Leeanne M. Goodrich, Ellen A. Robey, and Michael B. Eisen. “Mice Infected with Low-Virulence Strains of Toxoplasma Gondii Lose Their Innate Aversion to Cat Urine, Even After Extensive Parasite Clearance.” PLOS ONE, no. 9 (2013): e75246.
Jackson, James R.最小化最大延误率的生产线调度。技术报告43。加州大学洛杉矶分校管理科学研究项目,1955年。
Jackson, James R. Scheduling a Production Line to Minimize Maximum Tardiness. Technical report 43. Management Science Research Project, University of California, Los Angeles, 1955.
Jacobson, Van. “拥塞避免与控制。”载于《ACM SIGCOMM 计算机通信评论》 18卷,第4期(1988年):314–329页。
Jacobson, Van. “Congestion Avoidance and Control.” In ACM SIGCOMM Computer Communication Review 18, no. 4 (1988): 314–329.
______。“看待网络的新视角。” 2006 年 8 月,加州山景城,谷歌讲座。https ://www.youtube.com/watch?v =oCZMoY3q2uM 。
______. “A New Way to Look at Networking.” Lecture at Google, Mountain View, CA, August 2006. https://www.youtube.com/watch?v=oCZMoY3q2uM.
詹姆斯·威廉。“伟人、伟大思想与环境。” 《大西洋月刊》 46(1880):441–459。
James, William. “Great Men, Great Thoughts, and the Environment.” Atlantic Monthly 46 (1880): 441–459.
______。心理学:简明课程。纽约:霍尔特,1892年。
______. Psychology: Briefer Course. New York: Holt, 1892.
杰伊,弗朗辛。《少即是多:极简主义生活指南:如何整理、组织和简化你的生活》。新泽西州梅德福:安雅出版社,2010年。
Jay, Francine. The Joy of Less: A Minimalist Living Guide: How to Declutter, Organize, and Simplify Your Life. Medford, NJ: Anja Press, 2010.
Jeffreys, Harold。“估计问题中先验概率的不变形式。” 《伦敦皇家学会会刊A辑:数学和物理科学》 186卷(1946年):453–461页。
Jeffreys, Harold. “An Invariant Form for the Prior Probability in Estimation Problems.” Proceedings of the Royal Society of London. Series A. Mathematical and Physical Sciences 186 (1946): 453–461.
______。概率论,第3版。英国牛津:牛津大学出版社,1961年。
______. Theory of Probability, 3rd ed. Oxford, UK: Oxford University Press, 1961.
Johnson, Selmer Martin。“包含设置时间的最优两阶段和三阶段生产计划。” 《海军研究后勤季刊》 1,第1期(1954年):61-68。
Johnson, Selmer Martin. “Optimal Two- and Three-Stage Production Schedules with Setup Times Included.” Naval Research Logistics Quarterly 1, no. 1 (1954): 61–68.
Johnson, Theodore 和 Dennis Shasha。“2Q:一种低开销高性能缓冲区管理替换算法。” VLDB '94 第20届超大型数据库国际会议论文集,1994年,第439–450页。
Johnson, Theodore, and Dennis Shasha. “2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm.” VLDB ’94 Proceedings of the 20th International Conference on Very Large Data Bases, 1994, 439–450.
Jones, Thomas B. 和 David H. Ackley。“排序算法中的比较关键性”。2014年第 44 届 IEEE/IFIP 可靠系统与网络国际会议 (DSN),2014 年 6 月,第 726–731 页。
Jones, Thomas B., and David H. Ackley. “Comparison Criticality in Sorting Algorithms.” In 2014 44th Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN), June 2014, 726–731.
琼斯,威廉。《寻物启事:个人信息管理研究与实践》。马萨诸塞州伯灵顿:摩根考夫曼出版社,2007年。
Jones, William. Keeping Found Things Found: The Study and Practice of Personal Information Management. Burlington, MA: Morgan Kaufmann, 2007.
Kaelbling, Leslie Pack.嵌入式系统学习. 剑桥, 麻省: 麻省理工学院出版社, 1993.
Kaelbling, Leslie Pack. Learning in Embedded Systems. Cambrige, MA: MIT Press, 1993.
Kaelbling、Leslie Pack、Michael L. Littman 和 Andrew W. Moore。“强化学习:一项调查。” 《人工智能研究杂志》 4 (1996): 237–285。
Kaelbling, Leslie Pack, Michael L. Littman, and Andrew W. Moore. “Reinforcement Learning: A Survey.” Journal of Artificial Intelligence Research 4 (1996): 237–285.
卡尼格尔,罗伯特。《最佳方法:弗雷德里克·温斯洛·泰勒与效率之谜》。纽约:维京企鹅出版社,1997年。
Kanigel, Robert. The One Best Way: Frederick Winslow Taylor and the Enigma of Efficiency. New York: Viking Penguin, 1997.
康德,伊曼纽尔。形而上学的基本原理。里加:约翰·弗里德里希·哈特诺赫,1785 年。
Kant, Immanuel. Grundlegung zur Metaphysik der Sitten. Riga: Johann Friedrich Hartknoch, 1785.
______。对实践的批判。里加:约翰·弗里德里希·哈特诺赫,1788 年。
______. Kritik der praktischen Vernunft. Riga: Johann Friedrich Hartknoch, 1788.
Karmarkar, Narendra。“一种新的线性规划多项式时间算法。”载于第十六届ACM计算理论研讨会论文集,1984年,第302-311页。
Karmarkar, Narendra. “A New Polynomial-Time Algorithm for Linear Programming.” In Proceedings of the Sixteenth Annual ACM Symposium on Theory of Computing, 1984, 302–311.
Karp, Richard M.“随机算法简介。”离散应用数学34, no. 1 (1991): 165–201。
Karp, Richard M. “An Introduction to Randomized Algorithms.” Discrete Applied Mathematics 34, no. 1 (1991): 165–201.
______ . “组合问题的可约性。”《计算机计算复杂性》,第 85-103 页。纽约:Plenum,1972 年。
______. “Reducibility Among Combinatorial Problems.” In Complexity of Computer Computations, 85–103. New York: Plenum, 1972.
Katajainen, Jyrki 和 Jesper Larsson Träff。“对归并排序程序的细致分析。”摘自《算法与复杂性:第三届意大利会议 CIAC '97》。柏林:Springer,1997 年。
Katajainen, Jyrki, and Jesper Larsson Träff. “A Meticulous Analysis of Mergesort Programs.” In Algorithms and Complexity: Third Italian Conference CIAC ’97. Berlin: Springer, 1997.
Katehakis, Michael N. 和 Herbert Robbins。“从多个群体中进行顺序选择。” 《美国国家科学院院刊》 92 (1995): 8584–8585。
Katehakis, Michael N., and Herbert Robbins. “Sequential Choice from Several Populations.” Proceedings of the National Academy of Sciences 92 (1995): 8584–8585.
Kelly, FP,“折扣因子接近于1的多臂赌博机:伯努利情形”。《统计年鉴》 9(1981年):987–1001。
Kelly, F. P. “Multi-Armed Bandits with Discount Factor Near One: The Bernoulli Case.” Annals of Statistics 9 (1981): 987–1001.
Kelly, John L. “信息率的新解读”。《信息理论》,IRE Transactions on 2,no. 3 (1956): 185–189。
Kelly, John L. “A New Interpretation of Information Rate.” Information Theory, IRE Transactions on 2, no. 3 (1956): 185–189.
Khachiyan, Leonid G.“线性规划中的多项式算法”。USSR计算数学和数学物理20,第1期(1980): 53-72。
Khachiyan, Leonid G. “Polynomial Algorithms in Linear Programming.” USSR Computational Mathematics and Mathematical Physics 20, no. 1 (1980): 53–72.
Khot, Subhash 和 Oded Regev. “顶点覆盖可能难以近似到 2- ε以内。” 《计算机与系统科学杂志》 74,第 3 期 (2008): 335–349。
Khot, Subhash, and Oded Regev. “Vertex Cover Might Be Hard to Approximate to Within 2-ε.” Journal of Computer and System Sciences 74, no. 3 (2008): 335–349.
Kidd, Celeste, Holly Palmeri 和 Richard N. Aslin。“理性零食:幼儿在棉花糖任务中的决策受环境可靠性信念的影响。” 《认知》 126卷,第1期(2013年):109–114页。
Kidd, Celeste, Holly Palmeri, and Richard N. Aslin. “Rational Snacking: Young Children’s Decision-Making on the Marshmallow Task Is Moderated by Beliefs About Environmental Reliability.” Cognition 126, no. 1 (2013): 109–114.
Kilburn, Tom, David BG Edwards, MJ Lanigan 和 Frank H. Sumner。“单级存储系统”。IRE电子计算机学报(1962): 223–235。
Kilburn, Tom, David B. G. Edwards, M. J. Lanigan, and Frank H. Sumner. “One-Level Storage System.” IRE Transactions on Electronic Computers (1962): 223–235.
Kinsbourne, Marcel. “躯体扭转:交叉运动演化的模型。” 《神经心理学》 27卷,第5期(2013年):511。
Kinsbourne, Marcel. “Somatic Twist: A Model for the Evolution of Decussation.” Neuropsychology 27, no. 5 (2013): 511.
Kirby, Kris N. “竞标未来:反对延迟奖励规范折扣的证据。” 《实验心理学杂志:总论》 126卷,第1期(1997年):54-70。
Kirby, Kris N. “Bidding on the Future: Evidence Against Normative Discounting of Delayed Rewards.” Journal of Experimental Psychology: General 126, no. 1 (1997): 54–70.
Kirkpatrick, Scott, CD Gelatt 和 MP Vecchi. “通过模拟退火进行优化。” Science 220, no. 4598 (1983): 671–680.
Kirkpatrick, Scott, C. D. Gelatt, and M. P. Vecchi. “Optimization by Simulated Annealing.” Science 220, no. 4598 (1983): 671–680.
Knuth, Donald E. “古巴比伦算法”。《ACM通讯》 15卷,第7期(1972年):671–677页。
Knuth, Donald E. “Ancient Babylonian Algorithms.” Communications of the ACM 15, no. 7 (1972): 671–677.
______。《计算机编程艺术》第1卷:基本算法,第3版。波士顿:Addison-Wesley,1997年。
______. The Art of Computer Programming, Volume 1: Fundamental Algorithms, 3rd ed. Boston: Addison-Wesley, 1997.
______。《计算机编程艺术》第3卷:排序和搜索,第3版。波士顿:Addison-Wesley,1997年。
______. The Art of Computer Programming, Volume 3: Sorting and Searching, 3rd ed. Boston: Addison-Wesley, 1997.
______ . “术语提案”。ACM SIGACT News 6,第1期(1974年):12-18。
______. “A Terminological Proposal.” ACM SIGACT News 6, no. 1 (1974): 12–18.
______ . “2014 年 TeX 调整。” TUGboat 35,第 1 期(2014 年)。
______. “The TeX Tuneup of 2014.” TUGboat 35, no. 1 (2014).
______。计算机科学家很少谈论的事情。斯坦福,加州:语言/信息研究中心,2001年。
______. Things a Computer Scientist Rarely Talks About. Stanford, CA: Center for the Study of Language/Information, 2001.
______ . “冯·诺依曼的第一个计算机程序。” ACM 计算概览 (CSUR) 2,第 4 期 (1970 年 12 月): 247–260。
______. “Von Neumann’s First Computer Program.” ACM Computing Surveys (CSUR) 2, no. 4 (December 1970): 247–260.
科斯特勒,亚瑟。《分水岭:约翰尼斯·开普勒传记》。纽约花园城:Doubleday出版社,1960年。
Koestler, Arthur. The Watershed: A Biography of Johannes Kepler. Garden City, NY: Doubleday, 1960.
Kozen, Dexter 和 Shmuel Zaks。“找零问题的最佳界限。”载于《自动机、语言与编程》,700: 150–161。由 Andrzej Lingas、Rolf Karlsson 和 Svante Carlsson 编辑。柏林:Springer,1993 年。
Kozen, Dexter, and Shmuel Zaks. “Optimal Bounds for the Change-Making Problem.” In Automata, Languages and Programming, 700: 150–161. Edited by Andrzej Lingas, Rolf Karlsson, and Svante Carlsson. Berlin: Springer, 1993.
Lai, Tze Leung 和 Herbert Robbins。“渐近有效的自适应分配规则。” 《应用数学进展》 6 (1985): 4-22。
Lai, Tze Leung, and Herbert Robbins. “Asymptotically Efficient Adaptive Allocation Rules.” Advances in Applied Mathematics 6 (1985): 4–22.
Lamport, Leslie, Robert Shostak 和 Marshall Pease。“拜占庭将军问题”。《ACM 编程语言和系统汇刊》(TOPLAS) 4,第 3 期(1982 年):382–401。
Lamport, Leslie, Robert Shostak, and Marshall Pease. “The Byzantine Generals Problem.” ACM Transactions on Programming Languages and Systems (TOPLAS) 4, no. 3 (1982): 382–401.
拉普拉斯,皮埃尔-西蒙。《论概率的哲学论文》。1812年。重印,纽约:多佛,1951年。
Laplace, Pierre-Simon. A Philosophical Essay on Probabilities. 1812. Reprint, New York: Dover, 1951.
______ . “事件原因概率回忆录”。《统计科学》 1 (1774/1986): 364–378。
______. “Memoir on the Probability of the Causes of Events.” Statistical Science 1 (1774/1986): 364–378.
______。概率分析理论。巴黎:Ve Courcier 女士,1812 年。
______. Théorie analytique des probabilités. Paris: Mme Ve Courcier, 1812.
Lawler, Eugene L. “老故事”。载于《数学规划史:个人回忆录》,第97–106页。阿姆斯特丹:CWI/北荷兰出版社,1991年。
Lawler, Eugene L. “Old Stories.” In History of Mathematical Programming. A Collection of Personal Reminiscences, 97–106. Amsterdam: CWI/North-Holland, 1991.
______ . “受优先约束的单台机器的最优排序。” 《管理科学》 19,第5期(1973年):544-546。
______. “Optimal Sequencing of a Single Machine Subject to Precedence Constraints.” Management Science 19, no. 5 (1973): 544–546.
______。单机调度以最小化延迟作业数量。技术报告。伯克利:加州大学,1983年。
______. Scheduling a Single Machine to Minimize the Number of Late Jobs. Technical report. Berkeley: University of California, 1983.
______ . “调度单台机器以最小化延迟作业数量”,UCB/CSD-83-139号(1983年)。http ://www.eecs.berkeley.edu/Pubs/TechRpts/1983/6344.html。
______. “Scheduling a Single Machine to Minimize the Number of Late Jobs,” no. UCB/CSD-83-139 (1983). http://www.eecs.berkeley.edu/Pubs/TechRpts/1983/6344.html.
______ . “在优先约束下对作业进行排序以最小化总加权完成时间。”离散数学年鉴2 (1978): 75–90。
______. “Sequencing Jobs to Minimize Total Weighted Completion Time Subject to Precedence Constraints.” Annals of Discrete Mathematics 2 (1978): 75–90.
Lawler, Eugene L.、Jan Karel Lenstra 和 Alexander HG Rinnooy Kan。“给亚历山大的礼物!:在调度理论领域发挥作用。” Optima 7(1982):1-3。
Lawler, Eugene L., Jan Karel Lenstra, and Alexander H. G. Rinnooy Kan. “A Gift for Alexander!: At Play in the Fields of Scheduling Theory.” Optima 7 (1982): 1–3.
Lawler, Eugene L.、Jan Karel Lenstra、Alexander HG Rinnooy Kan 和 David B. Shmoys。“排序与调度:算法与复杂性”。载于《运筹学与管理科学手册》第4卷:生产与库存物流,由 SS Graves、AHG Rinnooy Kan 和 P. Zipkin 编辑,第445–522页。阿姆斯特丹:北荷兰出版社,1993年。
Lawler, Eugene L., Jan Karel Lenstra, Alexander H. G. Rinnooy Kan, and David B. Shmoys. “Sequencing and Scheduling: Algorithms and Complexity.” In Handbooks in Operations Research and Management Science, Volume 4: Logistics of Production and Inventory, edited by S. S. Graves, A. H. G. Rinnooy Kan, and P. Zipkin, 445–522. Amsterdam: North Holland, 1993.
______。旅行商问题:组合优化导览。纽约:Wiley,1985。
______. The Traveling Salesman Problem: A Guided Tour of Combinatorial Optimization. New York: Wiley, 1985.
拉扎里尼、马里奥。 “Un'applicazione del calcolo della probabilità alla Ricerca sperimentale di un valore approssimato di π ”。数学周期4 (1901):140–143。
Lazzarini, Mario. “Un’applicazione del calcolo della probabilità alla ricerca sperimentale di un valore approssimato di π.” Periodico di Matematica 4 (1901): 140–143.
Lee, Donghee, SH Noh, SL Min, J. Choi, JH Kim, Yookun Cho, 和 Chong Sang Kim. “LRFU:包含最近最少使用和最不常用策略的策略谱。” IEEE Transactions on Computers 50 (2001): 1352–1361.
Lee, Donghee, S. H. Noh, S. L. Min, J. Choi, J. H. Kim, Yookun Cho, and Chong Sang Kim. “LRFU: A Spectrum of Policies That Subsumes the Least Recently Used and Least Frequently Used Policies.” IEEE Transactions on Computers 50 (2001): 1352–1361.
Le Guin, Ursula K. 《逃离欧麦拉城的人》。载《新维度》第3卷。罗伯特·西尔弗伯格主编。纽约:Signet出版社,1973年。
Le Guin, Ursula K. “The Ones Who Walk Away from Omelas.” In New Dimensions 3. Edited by Robert Silverberg. New York: Signet, 1973.
Lenstra, Jan Karel. “二元性的神秘力量:悼念尤金·L·劳勒。” 《调度杂志》 1,第1期(1998):3-14。
Lenstra, Jan Karel. “The Mystical Power of Twoness: In Memoriam Eugene L. Lawler.” Journal of Scheduling 1, no. 1 (1998): 3–14.
Lenstra, Jan Karel, Alexander HG Rinnooy Kan 和 Peter Brucker。“机器调度问题的复杂性。”离散数学年鉴1 (1977): 343–362。
Lenstra, Jan Karel, Alexander H. G. Rinnooy Kan, and Peter Brucker. “Complexity of Machine Scheduling Problems.” Annals of Discrete Mathematics 1 (1977): 343–362.
勒纳,本。《利希滕贝格图形》。华盛顿州汤森港:铜峡谷出版社,2004年。
Lerner, Ben. The Lichtenberg Figures. Port Townsend, WA: Copper Canyon Press, 2004.
Lindley,Denis V.“动态规划和决策理论”。《应用统计学》 10(1961):39-51。
Lindley, Denis V. “Dynamic Programming and Decision Theory.” Applied Statistics 10 (1961): 39–51.
Lippman, Steven A. 和 John J. McCall。“求职经济学:一项调查。” 《经济调查》 14 (1976): 155–189。
Lippman, Steven A., and John J. McCall. “The Economics of Job Search: A Survey.” Economic Inquiry 14 (1976): 155–189.
Lorie, James H. 和 Leonard J. Savage。“资本配给中的三个问题。” 《商业杂志》第 28 卷,第 4 期 (1955): 229–239 页。
Lorie, James H., and Leonard J. Savage. “Three Problems in Rationing Capital.” Journal of Business 28, no. 4 (1955): 229–239.
Lowe、Christopher J.、Mark Terasaki、Michael Wu、Robert M. Freeman Jr.、Linda Runft、Kristen Kwan、Saori Haigo、Jochanan Aronowicz、Eric Lander、Chris Gruber 等。 “半索动物的背腹模式:对早期索动物进化的见解。” PLoS 生物学4,编号。 9(2006):e291。
Lowe, Christopher J., Mark Terasaki, Michael Wu, Robert M. Freeman Jr., Linda Runft, Kristen Kwan, Saori Haigo, Jochanan Aronowicz, Eric Lander, Chris Gruber, et al. “Dorsoventral Patterning in Hemichordates: Insights into Early Chordate Evolution.” PLoS Biology 4, no. 9 (2006): e291.
卢卡斯,理查德·E.,安德鲁·E·克拉克,雅尼斯·乔治利斯和艾德·迪纳。“重新审视适应性与幸福设定点模型:对婚姻状况变化的反应。”《人格与社会心理学杂志》第84卷,第3期(2003年):527–539页。
Lucas, Richard E., Andrew E. Clark, Yannis Georgellis, and Ed Diener. “Reexamining Adaptation and the Set Point Model of Happiness: Reactions to Changes in Marital Status.” Journal of Personality and Social Psychology 84, no. 3 (2003): 527–539.
Lueker, George S. “非负整数规划中的两个 NP 完全问题”。技术报告 TR-178,普林斯顿大学计算机科学实验室,1975 年。
Lueker, George S. “Two NP-Complete Problems in Nonnegative Integer Programming.” Technical Report TR-178, Computer Science Laboratory, Princeton University, 1975.
Luria, Salvador E.一台老虎机,一根破试管:一本自传。纽约:Harper & Row出版社,1984年。
Luria, Salvador E. A Slot Machine, a Broken Test Tube: An Autobiography. New York: Harper & Row, 1984.
MacQueen, J. 和 RG Miller。“最优持久策略。” 《运筹学》 8 (1960): 362–380。
MacQueen, J., and R. G. Miller. “Optimal Persistence Policies.” Operations Research 8 (1960): 362–380.
马尔萨斯,托马斯·罗伯特。《人口原理》。伦敦:J. Johnson,1798年。
Malthus, Thomas Robert. An Essay on the Principle of Population. London: J. Johnson, 1798.
马库斯,加里。《克鲁格:人类思维的偶然进化》。纽约:霍顿·米夫林·哈考特出版社,2009年。
Marcus, Gary. Kluge: The Haphazard Evolution of the Human Mind. New York: Houghton Mifflin Harcourt, 2009.
Markowitz, Harry. “投资组合选择。” 《金融杂志》 7, no. 1 (1952): 77–91。
Markowitz, Harry. “Portfolio Selection.” Journal of Finance 7, no. 1 (1952): 77–91.
______。投资组合选择:有效的投资多元化。纽约:威利,1959年。
______. Portfolio Selection: Efficient Diversification of Investments. New York: Wiley, 1959.
Martin, Thomas Commerford. “用电力统计一个国家。” 《电气工程师》 12,第184期(1891年):521–530。
Martin, Thomas Commerford. “Counting a Nation by Electricity.” Electrical Engineer 12, no. 184 (1891): 521–530.
McCall, John. “信息经济学与求职。” 《季刊经济学》第 84 卷 (1970): 113–126 页。
McCall, John. “Economics of Information and Job Search.” Quarterly Journal of Economics 84 (1970): 113–126.
McGrayne, Sharon Bertsch。《永不消亡的理论:贝叶斯规则如何破解恩尼格玛密码、追击俄罗斯潜艇,并在两个世纪的争议中胜出》。康涅狄格州纽黑文:耶鲁大学出版社,2011年。
McGrayne, Sharon Bertsch. The Theory That Would Not Die: How Bayes’ Rule Cracked the Enigma Code, Hunted Down Russian Submarines, & Emerged Triumphant from Two Centuries of Controversy. New Haven, CT: Yale University Press, 2011.
McGuire, Joseph T. 和 Joseph W. Kable。“决策者根据时间间隔经验校准行为持久性。” 《认知》 124,第2期(2012):216-226页。
McGuire, Joseph T., and Joseph W. Kable. “Decision Makers Calibrate Behavioral Persistence on the Basis of Time-Interval Experience.” Cognition 124, no. 2 (2012): 216–226.
______。“理性的时间预测可能导致延迟满足的明显失败。” 《心理学评论》 120,第2期(2013):395。
______. “Rational Temporal Predictions Can Underlie Apparent Failures to Delay Gratification.” Psychological Review 120, no. 2 (2013): 395.
Megiddo, Nimrod 和 Dharmendra S. Modha. “自适应替换缓存算法优于 LRU。” 《计算机》第 37 卷,第 4 期 (2004): 58–65。
Megiddo, Nimrod, and Dharmendra S. Modha. “Outperforming LRU with an Adaptive Replacement Cache Algorithm.” Computer 37, no. 4 (2004): 58–65.
梅伦,安德鲁。《清理你的生活!戒掉杂乱习惯,彻底整理你的生活》。纽约:艾弗里出版社,2010年。
Mellen, Andrew. Unstuff Your Life! Kick the Clutter Habit and Completely Organize Your Life for Good. New York: Avery, 2010.
Menezes, Alfred J., Paul C. Van Oorschot 和 Scott A Vanstone。《应用密码学手册》。佛罗里达州博卡拉顿:CRC 出版社,1996 年。
Menezes, Alfred J., Paul C. Van Oorschot, and Scott A Vanstone. Handbook of Applied Cryptography. Boca Raton, FL: CRC Press, 1996.
门格尔、卡尔. “达斯博滕问题。” Ergebnisse eines mathematischen kolloquiums 2 (1932): 11–12。
Menger, Karl. “Das botenproblem.” Ergebnisse eines mathematischen kolloquiums 2 (1932): 11–12.
Metropolis, Nicholas、Arianna W. Rosenbluth、Marshall N. Rosenbluth、Augusta H. Teller 和 Edward Teller。“利用快速计算机进行状态方程计算。” 《化学物理杂志》 21卷,第6期(1953年):1087–1092页。
Metropolis, Nicholas, Arianna W. Rosenbluth, Marshall N. Rosenbluth, Augusta H. Teller, and Edward Teller. “Equation of State Calculations by Fast Computing Machines.” Journal of Chemical Physics 21, no. 6 (1953): 1087–1092.
Meyer, Robert J. 和 Yong Shi。“模糊条件下的顺序选择:武装老虎机问题的直观解决方案。” 《管理科学》 41 (1995): 817–834。
Meyer, Robert J., and Yong Shi. “Sequential Choice Under Ambiguity: Intuitive Solutions to the Armed-Bandit Problem.” Management Science 41 (1995): 817–834.
Millard-Ball, Adam、Rachel R. Weinberger 和 Robert C. Hampshire。“路边停车位是 80% 满还是 20% 空?评估旧金山停车收费实验的影响。”《交通研究 A 辑:政策与实践》第 63 卷 (2014): 76–92。
Millard-Ball, Adam, Rachel R. Weinberger, and Robert C. Hampshire. “Is the Curb 80% Full or 20% Empty? Assessing the Impacts of San Francisco’s Parking Pricing Experiment.” Transportation Research Part A: Policy and Practice 63 (2014): 76–92.
Mischel, Walter, Ebbe B. Ebbesen 和 Antonette Raskoff Zeiss。“延迟满足的认知与注意机制。” 《人格与社会心理学杂志》 21卷,第2期(1972年):第204页。
Mischel, Walter, Ebbe B. Ebbesen, and Antonette Raskoff Zeiss. “Cognitive and Attentional Mechanisms in Delay of Gratification.” Journal of Personality and Social Psychology 21, no. 2 (1972): 204.
Mischel, Walter, Yuichi Shoda 和 Monica I. Rodriguez。“儿童的延迟满足”。《科学》 244,第4907期(1989年):933–938。
Mischel, Walter, Yuichi Shoda, and Monica I. Rodriguez. “Delay of Gratification in Children.” Science 244, no. 4907 (1989): 933–938.
Mitzenmacher, Michael 和 Eli Upfal。《概率与计算:随机算法与概率分析》。英国剑桥:剑桥大学出版社,2005年。
Mitzenmacher, Michael, and Eli Upfal. Probability and Computing: Randomized Algorithms and Probabilistic Analysis. Cambridge, UK: Cambridge University Press, 2005.
Monsell, Stephen. “任务切换。” 《认知科学趋势》 7, no. 3 (2003): 134–140.
Monsell, Stephen. “Task Switching.” Trends in Cognitive Sciences 7, no. 3 (2003): 134–140.
Moore, Gordon E. “在集成电路上塞入更多元件。” 《电子杂志》第 38 卷 (1965): 114–117 页。
Moore, Gordon E. “Cramming More Components onto Integrated Circuits.” Electronics Magazine 38 (1965): 114–117.
______ . “数字集成电子学的进展。”载于1975年国际电子设备会议技术文摘,1975年,第11-13页。
______. “Progress in Digital Integrated Electronics.” In International Electronic Devices Meeting 1975 Technical Digest, 1975, 11–13.
Moore, J. Michael. “一种用于最小化延迟作业数量的N作业单机排序算法。” 《管理科学》 15卷,第1期(1968年):102–109。
Moore, J. Michael. “An N Job, One Machine Sequencing Algorithm for Minimizing the Number of Late Jobs.” Management Science 15, no. 1 (1968): 102–109.
摩根斯坦,朱莉。《由内而外的整理:整理家庭、办公室和生活的万无一失的系统》。纽约:麦克米伦出版社,2004年。
Morgenstern, Julie. Organizing from the Inside Out: The Foolproof System for Organizing Your Home, Your Office and Your Life. New York: Macmillan, 2004.
Moser, L.“论凯莱的一个问题。” Scripta Mathematica 22 (1956): 289–292。
Moser, L. “On a Problem of Cayley.” Scripta Mathematica 22 (1956): 289–292.
Motwani, Rajeev 和 Prabhakar Raghavan。随机算法。英国剑桥:剑桥大学出版社,1995 年。
Motwani, Rajeev, and Prabhakar Raghavan. Randomized Algorithms. Cambridge, UK: Cambridge University Press, 1995.
______ . “随机算法”。ACM计算概览 (CSUR) 28,第 1 期 (1996): 33–37。
______. “Randomized Algorithms.” ACM Computing Surveys (CSUR) 28, no. 1 (1996): 33–37.
Mucci, AG,“论一类秘书问题”。《概率年鉴》 1 (1973): 417–427。
Mucci, A. G. “On a Class of Secretary Problems.” Annals of Probability 1 (1973): 417–427.
默里,大卫。《簿记、会计和商业算术史章节》。英国格拉斯哥:杰克逊·怀利出版社,1930年。
Murray, David. Chapters in the History of Bookkeeping, Accountancy and Commercial Arithmetic. Glasgow, UK: Jackson, Wylie, 1930.
Myerson, Roger B.“纳什均衡与经济理论史”。《经济文献杂志》 1999,1067–1082。
Myerson, Roger B. “Nash Equilibrium and the History of Economic Theory.” Journal of Economic Literature 1999, 1067–1082.
______ . “最优拍卖设计。” 《运筹学数学》 6,第1期(1981年):58-73。
______. “Optimal Auction Design.” Mathematics of Operations Research 6, no. 1 (1981): 58–73.
纳什,约翰 F。“ N人博弈中的均衡点。” 《美国国家科学院院刊》第 36 卷,第 1 期 (1950): 48–49。
Nash, John F. “Equilibrium Points in N-Person Games.” Proceedings of the National Academy of Sciences 36, no. 1 (1950): 48–49.
______ . “非合作博弈”。《数学年鉴》 54,第2期(1951年):286-295。
______. “Non-Cooperative Games.” Annals of Mathematics 54, no. 2 (1951): 286–295.
______ . “讨价还价问题。” 《计量经济学》 18卷,第2期(1950年):155-162。
______. “The Bargaining Problem.” Econometrica 18, no. 2 (1950): 155–162.
Navarro, Daniel J. 和 Ben R. Newell。“变化世界中的信息与奖励。”载于《认知科学学会第36届年会论文集》,2014年,1054–1059页。
Navarro, Daniel J., and Ben R. Newell. “Information Versus Reward in a Changing World.” In Proceedings of the 36th Annual Conference of the Cognitive Science Society, 2014, 1054–1059.
诺伊曼,约翰·冯和奥斯卡·摩根斯坦。《博弈论与经济行为》。新泽西州普林斯顿:普林斯顿大学出版社,1944年。
Neumann, John von, and Oskar Morgenstern. Theory of Games and Economic Behavior. Princeton, NJ: Princeton University Press, 1944.
Neyman, Jerzy。“基于古典概率论的统计估计理论概述。”《伦敦皇家学会哲学学报》,A辑,数学和物理科学, 236,第767期(1937年):333–380。
Neyman, Jerzy. “Outline of a Theory of Statistical Estimation Based on the Classical Theory of Probability.” Philosophical Transactions of the Royal Society of London. Series A, Mathematical and Physical Sciences 236, no. 767 (1937): 333–380.
Nichols, Kathleen 和 Van Jacobson。“控制队列延迟:现代 AQM 只是解决缓冲区膨胀问题的解决方案之一。” ACM 队列网络10,第 5 期 (2012):20-34。
Nichols, Kathleen, and Van Jacobson. “Controlling Queue Delay: A Modern AQM Is Just One Piece of the Solution to Bufferbloat.” ACM Queue Networks 10, no. 5 (2012): 20–34.
Nisan, Noam 和 Amir Ronen。“算法机制设计”。载于第三十一届 ACM 计算理论研讨会论文集,1999 年,第 129-140 页。
Nisan, Noam, and Amir Ronen. “Algorithmic Mechanism Design.” In Proceedings of the Thirty-First Annual ACM Symposium on Theory of Computing, 1999, 129–140.
Olshausen, Bruno A. 和 David J. Field。“通过学习自然图像的稀疏编码来呈现简单细胞感受野特性。” 《自然》 381 (1996): 607–609。
Olshausen, Bruno A., and David J. Field. “Emergence of Simple-Cell Receptive Field Properties by Learning a Sparse Code for Natural Images.” Nature 381 (1996): 607–609.
O'Neil, Elizabeth J., Patrick E. O'Neil 和 Gerhard Weikum. “数据库磁盘缓冲的 LRU- K页面替换算法”,ACM SIGMOD 记录22,第 2 期 (1993): 297–306。
O’Neil, Elizabeth J., Patrick E. O’Neil, and Gerhard Weikum. “The LRU-K Page Replacement Algorithm for Database Disk Buffering,” ACM SIGMOD Record 22, no. 2 (1993): 297–306.
Papadimitriou, Christos. “前言。”载于《算法博弈论》。Noam Nisan、Tim Roughgarden、Éva Tardos 和 Vijay V. Vazirani 编辑。英国剑桥:剑桥大学出版社,2007 年。
Papadimitriou, Christos. “Foreword.” In Algorithmic Game Theory. Edited by Noam Nisan, Tim Roughgarden, Éva Tardos, and Vijay V. Vazirani. Cambridge, UK: Cambridge University Press, 2007.
Papadimitriou, Christos H. 和 John N. Tsitsiklis。“最优排队网络控制的复杂性。” 《运筹学数学》 24 (1999): 293–305。
Papadimitriou, Christos H., and John N. Tsitsiklis. “The Complexity of Optimal Queuing Network Control.” Mathematics of Operations Research 24 (1999): 293–305.
Papadimitriou, Christos H. 和 Mihalis Yannakakis。“论复杂性作为有限理性。”载于第26届ACM计算理论研讨会论文集,1994年,第726–733页。
Papadimitriou, Christos H., and Mihalis Yannakakis. “On Complexity as Bounded Rationality.” In Proceedings of the Twenty-Sixth Annual ACM Symposium on Theory of Computing, 1994, 726–733.
Pardalos, Panos M. 和 Georg Schnitger。“检验约束二次规划中的局部最优性是NP难问题。” 《运筹学快报》 7 (1988): 33–35。
Pardalos, Panos M., and Georg Schnitger. “Checking Local Optimality in Constrained Quadratic Programming is NP-hard.” Operations Research Letters 7 (1988): 33–35.
帕累托,维尔弗雷多。政治经济课程。洛桑:F. Rouge,1896 年。
Pareto, Vilfredo. Cours d’économie politique. Lausanne: F. Rouge, 1896.
帕菲特,德里克。《理由与人》。英国牛津:牛津大学出版社,1984年。
Parfit, Derek. Reasons and Persons. Oxford, UK: Oxford University Press, 1984.
帕特诺伊,弗兰克。《等待:延迟的艺术与科学》。纽约:公共事务出版社,2012年。
Partnoy, Frank. Wait: The Art and Science of Delay. New York: PublicAffairs, 2012.
帕斯卡、布莱斯. 《宗教思想及其其他主题》。巴黎:纪尧姆·德普雷,1670 年。
Pascal, Blaise. Pensées sur la religion et sur quelques autres sujets. Paris: Guillaume Desprez, 1670.
彼得,劳伦斯·J.和雷蒙德·赫尔。《彼得原理:事情为何总是出错》。纽约:莫罗出版社,1969年。
Peter, Laurence J., and Raymond Hull. The Peter Principle: Why Things Always Go Wrong. New York: Morrow, 1969.
Petruccelli, Joseph D. “涉及选择和回忆观测值的不确定性的最佳选择问题。” 《应用概率杂志》 18 (1981): 415–425。
Petruccelli, Joseph D. “Best-Choice Problems Involving Uncertainty of Selection and Recall of Observations.” Journal of Applied Probability 18 (1981): 415–425.
Pettie, Seth 和 Vijaya Ramachandran。“一种最优最小生成树算法。” 《ACM 杂志》 49 卷,第 1 期 (2002):16-34。
Pettie, Seth, and Vijaya Ramachandran. “An Optimal Minimum Spanning Tree Algorithm.” Journal of the ACM 49, no. 1 (2002): 16–34.
Pinedo, Michael。调度:理论、算法与系统。纽约:Springer,2012。
Pinedo, Michael. Scheduling: Theory, Algorithms, and Systems. New York: Springer, 2012.
______ . “具有发布日期和到期日的随机调度。” 《运筹学》 31,第3期(1983年):559–572。
______. “Stochastic Scheduling with Release Dates and Due Dates.” Operations Research 31, no. 3 (1983): 559–572.
皮尔西格,罗伯特·M·禅与摩托车维修艺术。纽约:莫罗,1974年。
Pirsig, Robert M. Zen and the Art of Motorcycle Maintenance. New York: Morrow, 1974.
庞德斯通,威廉。《财富公式:击败赌场和华尔街的科学博彩系统不为人知的故事》。纽约:麦克米伦,2005年。
Poundstone, William. Fortune’s Formula: The Untold Story of the Scientific Betting System That Beat the Casinos and Wall Street. New York: Macmillan, 2005.
______。囚徒困境:约翰·冯·诺依曼、博弈论与原子弹之谜。纽约:Doubleday出版社,1992年。
______. Prisoner’s Dilemma: John von Neumann, Game Theory, and the Puzzle of the Bomb. New York: Doubleday, 1992.
Prabhakar, Balaji, Katherine N. Dektar, 和 Deborah M. Gordon. “无需空间信息的蚁群觅食活动调控。” PLoS Computational Biology 8, no. 8 (2012): e1002670.
Prabhakar, Balaji, Katherine N. Dektar, and Deborah M. Gordon. “The Regulation of Ant Colony Foraging Activity Without Spatial Information.” PLoS Computational Biology 8, no. 8 (2012): e1002670.
普雷斯曼、恩斯特·洛沃维奇和艾萨克·米哈伊洛维奇·索宁。 “随机数量对象的最佳选择问题。” Teoriya Veroyatnostei i ee Primeneniya 17 (1972): 695–706。
Presman, Ernst L’vovich, and Isaac Mikhailovich Sonin. “The Best Choice Problem for a Random Number of Objects.” Teoriya Veroyatnostei i ee Primeneniya 17 (1972): 695–706.
生产与运营管理协会。“James R. Jackson。” 《生产与运营管理》 17,第6期(2008年):i-ii。
Production and Operations Management Society. “James R. Jackson.” Production and Operations Management 17, no. 6 (2008): i–ii.
Rabin, Michael O. “测试素数性的概率算法”。《数论杂志》 12,第1期(1980):128–138。
Rabin, Michael O. “Probabilistic Algorithm for Testing Primality.” Journal of Number Theory 12, no. 1 (1980): 128–138.
Rabin, Michael O. 和 Dana Scott。“有限自动机及其决策问题。” 《IBM 研究与开发杂志》第 3 卷 (1959): 114–125 页。
Rabin, Michael O., and Dana Scott. “Finite Automata and Their Decision Problems.” IBM Journal of Research and Development 3 (1959): 114–125.
Raichle, Marcus E. 和 Debra A. Gusnard。“评估大脑的能量预算。” 《美国国家科学院院刊》第 99 卷,第 16 期(2002 年):10237–10239。
Raichle, Marcus E., and Debra A. Gusnard. “Appraising the Brain’s Energy Budget.” Proceedings of the National Academy of Sciences 99, no. 16 (2002): 10237–10239.
Ramakrishnan、Kadangode 和 Sally Floyd。关于在 IP 中添加显式拥塞通知 (ECN) 的提案。技术报告。RFC 2481,1999 年 1 月。
Ramakrishnan, Kadangode, and Sally Floyd. A Proposal to Add Explicit Congestion Notification (ECN) to IP. Technical report. RFC 2481, January 1999.
Ramakrishnan、Kadangode、Sally Floyd 和 David Black。在 IP 中添加显式拥塞通知 (ECN)。技术报告。RFC 3168,2001 年 9 月。
Ramakrishnan, Kadangode, Sally Floyd, and David Black. The Addition of Explicit Congestion Notification (ECN) to IP. Technical report. RFC 3168, September 2001.
Ramscar, Michael、Peter Hendrix、Cyrus Shaoul、Petar Milin 和 Harald Baayen。“认知衰退的迷思:终身学习的非线性动态。” 《认知科学专题》第 6 卷第 1 期(2014 年):5-42 页。
Ramscar, Michael, Peter Hendrix, Cyrus Shaoul, Petar Milin, and Harald Baayen. “The Myth of Cognitive Decline: Non-Linear Dynamics of Lifelong Learning.” Topics in Cognitive Science 6, no. 1 (2014): 5–42.
Rasmussen, Willis T. 和 Stanley R. Pliska。“使用折扣函数从序列中选择最大值。” 《应用数学与最优化》 2 (1975): 279–289。
Rasmussen, Willis T., and Stanley R. Pliska. “Choosing the Maximum from a Sequence with a Discount Function.” Applied Mathematics and Optimization 2 (1975): 279–289.
罗尔斯,约翰。《正义论》。马萨诸塞州剑桥:哈佛大学出版社,1971年。
Rawls, John. A Theory of Justice. Cambridge, MA: Harvard University Press, 1971.
Revusky, Samuel H. 和 Erwin W. Bedarf. “疾病与先前摄入新奇食物的关系。” 《科学》 155卷,第3759期(1967年):219–220页。
Revusky, Samuel H., and Erwin W. Bedarf. “Association of Illness with Prior Ingestion of Novel Foods.” Science 155, no. 3759 (1967): 219–220.
Reynolds, Andy M. “水母中主动和被动优化Lévy搜索的特征。” 《皇家学会界面杂志》 11,第99期(2014年):20140665。
Reynolds, Andy M. “Signatures of Active and Passive Optimized Lévy Searching in Jellyfish.” Journal of the Royal Society Interface 11, no. 99 (2014): 20140665.
Ridgway, Valentine F.“绩效评估的功能失调后果”。《行政科学季刊》1,第2期(1956年):240-247。
Ridgway, Valentine F. “Dysfunctional Consequences of Performance Measurements.” Administrative Science Quarterly 1, no. 2 (1956): 240–247.
Riley, John G. 和 William F. Samuelson。“最优拍卖”。《美国经济评论》 71卷,第3期(1981年):第381-392页。
Riley, John G., and William F. Samuelson. “Optimal Auctions.” American Economic Review 71, no. 3 (1981): 381–392.
Rittaud, Benoît 和 Albrecht Heeffer。“鸽巢原理:狄利克雷之前两个世纪。” 《数学情报》 36卷,第2期(2014年):27-29页。
Rittaud, Benoît, and Albrecht Heeffer. “The Pigeonhole Principle, Two Centuries Before Dirichlet.” Mathematical Intelligencer 36, no. 2 (2014): 27–29.
Rivest, Ronald L., Adi Shamir 和 Leonard Adleman。“一种获取数字签名和公钥密码系统的方法。” 《ACM 通讯》 21 卷,第 2 期 (1978):120–126 页。
Rivest, Ronald L., Adi Shamir, and Leonard Adleman. “A Method for Obtaining Digital Signatures and Public-Key Cryptosystems.” Communications of the ACM 21, no. 2 (1978): 120–126.
罗宾斯,赫伯特。“序贯实验设计的一些方面。” 《美国数学学会公报》 58 (1952): 527–535。
Robbins, Herbert. “Some Aspects of the Sequential Design of Experiments.” Bulletin of the American Mathematical Society 58 (1952): 527–535.
罗宾逊,朱莉娅。《论汉密尔顿博弈(旅行商问题)》。技术报告 RAND/RM-303。加州圣莫尼卡:兰德公司,1949年。
Robinson, Julia. On the Hamiltonian Game (a Traveling Salesman Problem). Technical report RAND/RM-303. Santa Monica, CA: RAND, 1949.
Rogerson, Richard, Robert Shimer 和 Randall Wright。《劳动力市场搜寻理论模型:综述》。技术报告。马萨诸塞州剑桥:美国国家经济研究局,2004年。
Rogerson, Richard, Robert Shimer, and Randall Wright. Search-Theoretic Models of the Labor Market: A Survey. Technical report. Cambridge, MA: National Bureau of Economic Research, 2004.
Rose, John S.“最优选择和分配问题。”运筹学30 (1982): 172–181。
Rose, John S. “A Problem of Optimal Choice and Assignment.” Operations Research 30 (1982): 172–181.
Rosenbaum, David A.、Lanyun Gong 和 Cory Adam Potts。“预先拖延:以额外的体力劳动为代价加速子目标完成。” 《心理科学》 25 卷,第 7 期(2014 年):1487–1496 页。
Rosenbaum, David A., Lanyun Gong, and Cory Adam Potts. “Pre-Crastination: Hastening Subgoal Completion at the Expense of Extra Physical Effort.” Psychological Science 25, no. 7 (2014): 1487–1496.
罗森布鲁斯,马歇尔。马歇尔·罗森布鲁斯接受凯-亨利克·巴斯采访。2003年8月11日,马里兰州学院公园市。
Rosenbluth, Marshall. Marshall Rosenbluth, interviewed by Kai-Henrik Barth. August 11, 2003, College Park, MD.
Rostker, Bernard D., Harry J. Thie, James L. Lacy, Jennifer H. Kawata, 和 Susanna W. Purnell. 1980年国防军官人事管理法:回顾性评估. 圣莫尼卡,加州:兰德公司,1993年。
Rostker, Bernard D., Harry J. Thie, James L. Lacy, Jennifer H. Kawata, and Susanna W. Purnell. The Defense Officer Personnel Management Act of 1980: A Retrospective Assessment. Santa Monica, CA: RAND, 1993.
Roughgarden, Tim 和 Éva Tardos. “自私路由有多糟糕?” ACM 杂志49,第 2 期 (2002): 236–259。
Roughgarden, Tim, and Éva Tardos. “How Bad Is Selfish Routing?” Journal of the ACM 49, no. 2 (2002): 236–259.
罗素,伯特兰。《伦理学要素》。载《哲学论文集》 ,13-59页。伦敦:朗文格林出版社,1910年。
Russell, Bertrand. “The Elements of Ethics.” In Philosophical Essays, 13–59. London: Longmans, Green, 1910.
Russell, Stuart 和 Peter Norvig。《人工智能:一种现代方法》,第三版。新泽西州上萨德尔河:培生出版社,2009 年。
Russell, Stuart, and Peter Norvig. Artificial Intelligence: A Modern Approach, 3rd ed. Upper Saddle River, NJ: Pearson, 2009.
Russell, Stuart 和 Eric Wefald。《做正确的事》。马萨诸塞州剑桥:麻省理工学院出版社,1991 年。
Russell, Stuart, and Eric Wefald. Do the Right Thing. Cambridge, MA: MIT Press, 1991.
萨根,卡尔。布罗卡氏脑:对科学浪漫的反思。纽约:兰登书屋,1979年。
Sagan, Carl. Broca’s Brain: Reflections on the Romance of Science. New York: Random House, 1979.
坂口稔。“与无信息秘书问题相关的双边序列博弈。” 《日本数学》第 29 卷 (1984): 961–974 页。
Sakaguchi, Minoru. “Bilateral Sequential Games Related to the No-Information Secretary Problem.” Mathematica Japonica 29 (1984): 961–974.
______ . “某些序贯抽样设计的动态规划。”数学分析与应用杂志2 (1961): 446–466。
______. “Dynamic Programming of Some Sequential Sampling Design.” Journal of Mathematical Analysis and Applications 2 (1961): 446–466.
Sakaguchi, Minoru 和 Mitsushi Tamaki。“论停车位随机出现的最佳停车问题。” 《信息学与控制论公报》 20 (1982): 1-10。
Sakaguchi, Minoru, and Mitsushi Tamaki. “On the Optimal Parking Problem in Which Spaces Appear Randomly.” Bulletin of Informatics and Cybernetics 20 (1982): 1–10.
萨特,让·保罗。《禁闭:独幕剧》。纽约:塞缪尔·弗伦奇出版社,1958年。
Sartre, Jean-Paul. No Exit: A Play in One Act. New York: Samuel French, 1958.
谢林,托马斯·C。“利他主义、卑鄙和其他潜在的战略行为。” 《美国经济评论》 68,第2期(1978年):229-230。
Schelling, Thomas C. “Altruism, Meanness, and Other Potentially Strategic Behaviors.” American Economic Review 68, no. 2 (1978): 229–230.
______。《冲突策略》。马萨诸塞州剑桥:哈佛大学出版社,1960年。
______. The Strategy of Conflict. Cambridge, MA: Harvard University Press, 1960.
施奈尔,布鲁斯。应用密码学。纽约:Wiley,1994。
Schneier, Bruce. Applied Cryptography. New York: Wiley, 1994.
Schrage, Linus。“最短剩余处理时间原则的最优性证明。” 《运筹学》 16卷,第3期(1968年):687–690页。
Schrage, Linus. “A Proof of the Optimality of the Shortest Remaining Processing Time Discipline.” Operations Research 16, no. 3 (1968): 687–690.
Schrijver, Alexander。“组合优化的历史(1960年以前)”。载于《运筹学与管理科学手册:离散优化》。Karen Aardal、George L. Nemhauser 和 Robert Weismantel 编辑。阿姆斯特丹:爱思唯尔,2005年,第1-68页。
Schrijver, Alexander. “On the History of Combinatorial Optimization (Till 1960).” In Handbooks in Operations Research and Management Science: Discrete Optimization. Edited by Karen Aardal, George L. Nemhauser, and Robert Weismantel. Amsterdam: Elsevier, 2005, 1–68.
Schwartz, Jacob T.“用于验证多项式恒等式的快速概率算法。” Journal of the ACM 27, no. 4 (1980): 701–717。
Schwartz, Jacob T. “Fast Probabilistic Algorithms for Verification of Polynomial Identities.” Journal of the ACM 27, no. 4 (1980): 701–717.
Seale, Darryl A. 和 Amnon Rapoport。“相对等级的序贯决策:对‘秘书问题’的实验研究。” 《组织行为与人类决策过程》 69 (1997): 221–236。
Seale, Darryl A., and Amnon Rapoport. “Sequential Decision Making with Relative Ranks: An Experimental Investigation of the ‘Secretary Problem.’” Organizational Behavior and Human Decision Processes 69 (1997): 221–236.
Sen, Amartya。“目标、承诺和身份。” 《法律、经济与组织杂志》 1 (1985): 341–355。
Sen, Amartya. “Goals, Commitment, and Identity.” Journal of Law, Economics, and Organization 1 (1985): 341–355.
Sethi, Rajiv. “算法交易与价格波动。” Rajiv Sethi (博客),2010年5月7日,http://rajivsethi.blogspot.com/2010/05/algorithmic-trading-and-price.html。
Sethi, Rajiv. “Algorithmic Trading and Price Volatility.” Rajiv Sethi (blog), May 7, 2010, http://rajivsethi.blogspot.com/2010/05/algorithmic-trading-and-price.html.
Sevcik, Kenneth C.“利用服务时间分布实现最小总损失调度。” Journal of the ACM 21, no. 1 (1974): 66–75。
Sevcik, Kenneth C. “Scheduling for Minimum Total Loss Using Service Time Distributions.” Journal of the ACM 21, no. 1 (1974): 66–75.
Shallit, Jeffrey。“这个国家需要的是一枚18美分的硬币。” 《数学情报》 25卷,第2期(2003年):20-23页。
Shallit, Jeffrey. “What This Country Needs Is an 18¢ Piece.” Mathematical Intelligencer 25, no. 2 (2003): 20–23.
莎莎,丹尼斯和凯茜·拉泽尔。《走出他们的思想:15位伟大计算机科学家的生活和发现》。纽约:Springer,1998年。
Shasha, Dennis, and Cathy Lazere. Out of Their Minds: The Lives and Discoveries of 15 Great Computer Scientists. New York: Springer, 1998.
Shasha, Dennis 和 Michael Rabin。“Michael Rabin 访谈”。《ACM 通讯》 53 卷,第 2 期 (2010): 37–42。
Shasha, Dennis, and Michael Rabin. “An Interview with Michael Rabin.” Communications of the ACM 53, no. 2 (2010): 37–42.
肖,弗雷德里克·S。《放松方法简介》。纽约:多佛出版社,1953年。
Shaw, Frederick S. An Introduction to Relaxation Methods. New York: Dover, 1953.
萧伯纳,乔治·伯纳德。《人与超人:一部喜剧与一种哲学》。马萨诸塞州剑桥:哈佛大学出版社,1903年。
Shaw, George Bernard. Man and Superman: A Comedy and a Philosophy. Cambridge, MA: Harvard University Press, 1903.
Shoup, Donald.免费停车的高成本。芝加哥: APA Planners Press, 2005。
Shoup, Donald. The High Cost of Free Parking. Chicago: APA Planners Press, 2005.
Simon, Herbert A.,“理性选择的行为模型”。《季刊经济学》第69卷,第1期(1955年):99-118。
Simon, Herbert A. “A Behavioral Model of Rational Choice.” Quarterly Journal of Economics 69, no. 1 (1955): 99–118.
______。人的模型。纽约:威利,1957年。
______. Models of Man. New York: Wiley, 1957.
______ . “论一类偏态分布函数。” Biometrika,1955,425–440。
______. “On a Class of Skew Distribution Functions.” Biometrika, 1955, 425–440.
Siroker, Dan. “奥巴马如何通过简单实验筹集 6000 万美元。” Optimizely 博客:您真正会用的 A/B 测试(博客),2010 年 11 月 29 日,https://blog.optimizely.com/2010/11/29/how-obama-raised-60-million-by-running-a-simple-experiment/。
Siroker, Dan. “How Obama Raised $60 Million by Running a Simple Experiment.” The Optimizely Blog: A/B Testing You’ll Actually Use (blog), November 29, 2010, https://blog.optimizely.com/2010/11/29/how-obama-raised-60-million-by-running-a-simple-experiment/.
Siroker, Dan 和 Pete Koomen。A /B 测试:将点击转化为客户的最有效方法。纽约:Wiley,2013 年。
Siroker, Dan, and Pete Koomen. A/B Testing: The Most Powerful Way to Turn Clicks into Customers. New York: Wiley, 2013.
Sleator, Daniel D. 和 Robert E. Tarjan. “列表更新和分页规则的摊销效率。” 《ACM 通讯》第 28 卷 (1985): 202–208 页。
Sleator, Daniel D., and Robert E. Tarjan. “Amortized Efficiency of List Update and Paging Rules.” Communications of the ACM 28 (1985): 202–208.
亚当·斯密,《道德情操论》。1759年为A.米勒在斯特兰德出版社出版;以及为A.金凯德和J.贝尔在爱丁堡出版社出版。
Smith, Adam. The Theory of Moral Sentiments. Printed for A. Millar, in the Strand; and A. Kincaid and J. Bell, in Edinburgh, 1759.
Smith, MH,“就业不确定的秘书问题”。《应用概率杂志》 12,第3期(1975年):620–624。
Smith, M. H. “A Secretary Problem with Uncertain Employment.” Journal of Applied Probability 12, no. 3 (1975): 620–624.
Smith, Wayne E.“单阶段生产的各种优化器”。《海军研究后勤季刊》 3,第1-2期(1956年):59-66。
Smith, Wayne E. “Various Optimizers for Single-Stage Production.” Naval Research Logistics Quarterly 3, nos. 1–2 (1956): 59–66.
Solovay, Robert 和 Volker Strassen。“素数的快速蒙特卡罗检验。” SIAM 计算杂志6 (1977): 84–85。
Solovay, Robert, and Volker Strassen. “A Fast Monte-Carlo Test for Primality.” SIAM Journal on Computing 6 (1977): 84–85.
Starr, Norman。“如何在必要时赢得战争:基于成功运行的最优停止策略。” 《数理统计年鉴》 43卷,第6期(1972年):1884–1893页。
Starr, Norman. “How to Win a War if You Must: Optimal Stopping Based on Success Runs.” Annals of Mathematical Statistics 43, no. 6 (1972): 1884–1893.
Stephens, David W. 和 John R. Krebs。《觅食理论》。新泽西州普林斯顿:普林斯顿大学出版社,1986年。
Stephens, David W., and John R. Krebs. Foraging Theory. Princeton, NJ: Princeton University Press, 1986.
斯图尔特,玛莎。《玛莎·斯图尔特的家政手册:家居必备指南》。纽约:克拉克森·波特出版社,2006年。
Stewart, Martha. Martha Stewart’s Homekeeping Handbook: The Essential Guide to Caring for Everything in Your Home. New York: Clarkson Potter, 2006.
Steyvers, Mark, Michael D. Lee 和 Eric-Jan Wagenmakers。“对老虎机问题中人类决策的贝叶斯分析。” 《数学心理学杂志》 53 (2009): 168–179。
Steyvers, Mark, Michael D. Lee, and Eric-Jan Wagenmakers. “A Bayesian Analysis of Human Decision-Making on Bandit Problems.” Journal of Mathematical Psychology 53 (2009): 168–179.
斯蒂格勒,乔治·J。“信息经济学。” 《政治经济学杂志》 69(1961):213-225。
Stigler, George J. “The Economics of Information.” Journal of Political Economy 69 (1961): 213–225.
______ . “劳动力市场中的信息。” 《政治经济学杂志》 70 (1962): 94-105。
______. “Information in the Labor Market.” Journal of Political Economy 70 (1962): 94–105.
斯蒂格勒,斯蒂芬 M.“斯蒂格勒同名定律”。《纽约科学院学报》第 39 卷 (1980): 147–157 页。
Stigler, Stephen M. “Stigler’s Law of Eponymy.” Transactions of the New York Academy of Sciences 39 (1980): 147–157.
Tamaki, Mitsushi。“某些停止问题的自适应方法。” 《应用概率杂志》 22 (1985): 644–652。
Tamaki, Mitsushi. “Adaptive Approach to Some Stopping Problems.” Journal of Applied Probability 22 (1985): 644–652.
______ . “最优停车问题。” 《应用概率杂志》 19 (1982): 803–814。
______. “An Optimal Parking Problem.” Journal of Applied Probability 19 (1982): 803–814.
______ . “掉头停车问题中的最优停车策略。” 《应用概率杂志》 25 (1988): 363–374。
______. “Optimal Stopping in the Parking Problem with U-Turn.” Journal of Applied Probability 25 (1988): 363–374.
托马斯,海伦。《白宫前排:我的生活和时代》。纽约:西蒙与舒斯特出版社,2000年。
Thomas, Helen. Front Row at the White House: My Life and Times. New York: Simon & Schuster, 2000.
汤普森,威廉·R。“从两个样本的证据来看,一个未知概率超过另一个未知概率的可能性。” Biometrika 25 (1933): 285–294。
Thompson, William R. “On the Likelihood That One Unknown Probability Exceeds Another in View of the Evidence of Two Samples.” Biometrika 25 (1933): 285–294.
梭罗,亨利·戴维。“行走”。《大西洋月刊》第9卷(1862年):657–674页。
Thoreau, Henry David. “Walking.” Atlantic Monthly 9 (1862): 657–674.
Tibshirani, Robert. “通过套索函数进行回归收缩和选择。” 《皇家统计学会杂志》。B辑(方法论) 58,第1期(1996年):267–288。
Tibshirani, Robert. “Regression Shrinkage and Selection via the Lasso.” Journal of the Royal Statistical Society. Series B (Methodological) 58, no. 1 (1996): 267–288.
Tikhonov, AN 和 VY Arsenin。《不适定问题的解》。华盛顿特区:温斯顿,1977 年。
Tikhonov, A. N., and V. Y. Arsenin. Solution of Ill-Posed Problems. Washington, DC: Winston, 1977.
Todd, Peter M. “配偶搜寻中的共同进化认知机制”。《进化与社会思维:进化心理学与社会认知》(纽约)9 (2007): 145–159。
Todd, Peter M. “Coevolved Cognitive Mechanisms in Mate Search.” Evolution and the Social Mind: Evolutionary Psychology and Social Cognition (New York) 9 (2007): 145–159.
Todd, Peter M. 和 GF Miller。“从《傲慢与偏见》到《劝说》:寻找伴侣的满足感。” 摘自《让我们变得聪明的简单启发法》。G. Gigerenzer 和 PM Todd 主编。纽约:牛津大学出版社,1999 年,第 287-308 页。
Todd, Peter M., and G. F. Miller. “From Pride and Prejudice to Persuasion: Satisficing in Mate Search.” In Simple Heuristics That Make Us Smart. Edited by G. Gigerenzer and P. M. Todd. New York: Oxford University Press, 1999, 287–308.
Tolins, Jackson 和 Jean E. Fox Tree。“收件人的秘密渠道引导叙事发展。” 《语用学杂志》 70 (2014): 152–164。
Tolins, Jackson, and Jean E. Fox Tree. “Addressee Backchannels Steer Narrative Development.” Journal of Pragmatics 70 (2014): 152–164.
特蕾西,布莱恩。《吃掉那只青蛙!21个摆脱拖延、事半功倍的好方法》。加州奥克兰:贝雷特-科勒出版社,2007年。
Tracy, Brian. Eat That Frog! 21 Great Ways to Stop Procrastinating and Get More Done in Less Time. Oakland, CA: Berrett-Koehler, 2007.
Turing, Alan M. “论可计算数及其在判定问题中的应用”。1936年11月12日发表。《伦敦数学学会会刊》 s2-42,第1期(1937年):230–265。
Turing, Alan M. “On Computable Numbers, with an Application to the Entscheidungsproblem.” Read November 12, 1936. Proceedings of the London Mathematical Society s2-42, no. 1 (1937): 230–265.
______ . “论可计算数及其在判定问题中的应用:一个修正。” 《伦敦数学学会会刊》 s2-43,第1期(1938年):544–546页。
______. “On Computable Numbers, with an Application to the Entscheidungsproblem: A Correction.” Proceedings of the London Mathematical Society s2-43, no. 1 (1938): 544–546.
Tversky, Amos 和 Ward Edwards。“二元选择中的信息与奖励。” 《实验心理学杂志》 71 (1966): 680–683。
Tversky, Amos, and Ward Edwards. “Information Versus Reward in Binary Choices.” Journal of Experimental Psychology 71 (1966): 680–683.
乌拉姆,斯坦尼斯瓦夫·M。《数学家的历险记》。纽约:斯克里布纳,1976 年。
Ulam, Stanislaw M. Adventures of a Mathematician. New York: Scribner, 1976.
Ullman, Ellen. “超越时间:对编程人生的反思。” Educom Review 31 (1996): 53–59.
Ullman, Ellen. “Out of Time: Reflections on the Programming Life.” Educom Review 31 (1996): 53–59.
英国ECMO合作组。“英国ECMO合作试验:随访至1岁。” 《儿科学101》,第4期(1998年):e1。
UK Collaborative ECMO Group. “The Collaborative UK ECMO Trial: Follow-up to 1 Year of Age.” Pediatrics 101, no. 4 (1998): e1.
Vazirani,Vijay V.近似算法。纽约:施普林格,2001。
Vazirani, Vijay V. Approximation Algorithms. New York: Springer, 2001.
Vickrey, William。“反投机、拍卖和竞争性密封投标。” 《金融杂志》 16卷,第1期(1961年):8-37页。
Vickrey, William. “Counterspeculation, Auctions, and Competitive Sealed Tenders.” Journal of Finance 16, no. 1 (1961): 8–37.
Waitzman, David。鸟类载体IP数据报传输标准。技术报告。RFC 1149,1990年4月。
Waitzman, David. A Standard for the Transmission of IP Datagrams on Avian Carriers. Technical report. RFC 1149, April 1990.
______。IP Over Avian Carriers 服务质量。技术报告。RFC 2549,1999 年 4 月。
______. IP Over Avian Carriers with Quality of Service. Technical report. RFC 2549, April 1999.
Ware, James H.“研究具有巨大潜在益处的疗法:ECMO。” 《统计科学》 4 (1989): 298–306。
Ware, James H. “Investigating Therapies of Potentially Great Benefit: ECMO.” Statistical Science 4 (1989): 298–306.
Ware, James H. 和 Michael F. Epstein。“关于 RH Bartlett 等人撰写的《新生儿呼吸衰竭的体外循环:一项前瞻性随机研究》的评论。” 《儿科学》 76 卷,第 5 期 (1985): 849–851。
Ware, James H., and Michael F. Epstein. “Comments on ‘Extracorporeal Circulation in Neonatal Respiratory Failure: A Prospective Randomized Study’ by R. H. Bartlett et al.” Pediatrics 76, no. 5 (1985): 849–851.
沃霍尔,安迪。《安迪·沃霍尔的哲学(从A到B再回来)》。纽约:Harcourt Brace Jovanovich,1975年。
Warhol, Andy. The Philosophy of Andy Warhol (from A to B and Back Again). New York: Harcourt Brace Jovanovich, 1975.
Weiss, Yair, Eero P. Simoncelli 和 Edward H. Adelson. “运动错觉作为最佳感知。” 《自然神经科学》 5 (2002): 598–604。
Weiss, Yair, Eero P. Simoncelli, and Edward H. Adelson. “Motion Illusions as Optimal Percepts.” Nature Neuroscience 5 (2002): 598–604.
Whittaker, Steve 和 Candace Sidner。“电子邮件超载:探索电子邮件的个人信息管理。”载于SIGCHI 计算机系统人为因素会议论文集,1996 年,第 276–283 页。
Whittaker, Steve, and Candace Sidner. “Email Overload: Exploring Personal Information Management of Email.” In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, 1996, 276–283.
Whittaker, Steve, Tara Matthews, Julian Cerruti, Hernan Badenes 和 John Tang。“我整理电子邮件是在浪费时间吗?一项关于电子邮件重新查找的研究。”载于SIGCHI 计算机系统人为因素会议论文集,2011 年,第 3449–3458 页。
Whittaker, Steve, Tara Matthews, Julian Cerruti, Hernan Badenes, and John Tang. “Am I Wasting My Time Organizing Email? A Study of Email Refinding.” In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, 2011, 3449–3458.
Whittle, Peter.时间优化:动态规划与随机控制。纽约:Wiley,1982。
Whittle, Peter. Optimization over Time: Dynamic Programming and Stochastic Control. New York: Wiley, 1982.
______ . “不安分的强盗:变化世界中的活动分配。” 《应用概率杂志》 25 (1988): 287–298。
______. “Restless Bandits: Activity Allocation in a Changing World.” Journal of Applied Probability 25 (1988): 287–298.
Wigderson, Avi. “知识、创造力与P与NP。” http://www.math.ias.edu/~avi/PUBLICATIONS/MYPAPERS/AW09/AW09.pdf,2009年。
Wigderson, Avi. “Knowledge, Creativity, and P versus NP.” http://www.math.ias.edu/~avi/PUBLICATIONS/MYPAPERS/AW09/AW09.pdf, 2009.
Wilkes, Maurice V.“从属内存和动态存储分配。” IEEE 电子计算机学报14 (1965): 270–271。
Wilkes, Maurice V. “Slave Memories and Dynamic Storage Allocation.” IEEE Transactions on Electronic Computers 14 (1965): 270–271.
Wright, JW,“找零问题”。《计算机协会杂志》第 22 卷 (1975): 125–128 页。
Wright, J. W. “The Change-Making Problem.” Journal of the Association of Computing Machinery 22 (1975): 125–128.
Wulf, William Allan 和 Sally A. McKee。“突破记忆墙:显而易见的启示。” ACM SIGARCH 计算机架构新闻23,第 1 期 (1995): 20-24。
Wulf, William Allan, and Sally A. McKee. “Hitting the Memory Wall: Implications of the Obvious.” ACM SIGARCH Computer Architecture News 23, no. 1 (1995): 20–24.
Xu, Fei 和 Joshua B. Tenenbaum。“词汇学习作为贝叶斯推理。” 《心理学评论》 114 (2007): 245–272。
Xu, Fei, and Joshua B. Tenenbaum. “Word Learning as Bayesian Inference.” Psychological Review 114 (2007): 245–272.
Yang, Mark CK,“基于相对秩和向后征求法识别随机序列的最大值”。《应用概率杂志》 11 (1974): 504–512。
Yang, Mark C. K. “Recognizing the Maximum of a Random Sequence Based on Relative Rank with Backward Solicitation.” Journal of Applied Probability 11 (1974): 504–512.
Yato, Takayuki 和 Takahiro Seta。“寻找另一解决方案的复杂性和完整性及其在谜题中的应用。” IEICE 电子、通信和计算机科学基础学报86,第 5 期 (2003): 1052–1060。
Yato, Takayuki, and Takahiro Seta. “Complexity and Completeness of Finding Another Solution and Its Application to Puzzles.” IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences 86, no. 5 (2003): 1052–1060.
Yngve, Victor H. “插话”。载于芝加哥语言学会第 6 次会议,1970 年,第 567–578 页。
Yngve, Victor H. “On Getting a Word in Edgewise.” In Chicago Linguistics Society, 6th Meeting, 1970, 567–578.
Zahniser, Rick. “时间盒对顶级团队绩效的影响。” 《软件开发》 3,第3期 (1995): 34–38。
Zahniser, Rick. “Timeboxing for Top Team Performance.” Software Development 3, no. 3 (1995): 34–38.
Zapol、Warren M.、Michael T. Snider、J. Donald Hill、Robert J. Fallat、Robert H. Bartlett、L. Henry Edmunds、Alan H. Morris、E. Converse Peirce、Arthur N. Thomas、Herbert J. Proctor 等。“体外膜氧合治疗严重急性呼吸衰竭:一项随机前瞻性研究。” 《美国医学会杂志》 242,第20期(1979年):2193–2196。
Zapol, Warren M., Michael T. Snider, J. Donald Hill, Robert J. Fallat, Robert H. Bartlett, L. Henry Edmunds, Alan H. Morris, E. Converse Peirce, Arthur N. Thomas, Herbert J. Proctor, et al. “Extracorporeal Membrane Oxygenation in Severe Acute Respiratory Failure: A Randomized Prospective Study.” Journal of the American Medical Association 242, no. 20 (1979): 2193–2196.
Zelen, Marvin。“赢家规则与对照临床试验。” 《美国统计协会杂志》 64,第325期(1969年):131-146。
Zelen, Marvin. “Play the Winner Rule and the Controlled Clinical Trial.” Journal of the American Statistical Association 64, no. 325 (1969): 131–146.
Zippel, Richard. “稀疏多项式的概率算法。”载于EUROSAM 79国际符号与代数计算研讨会论文集。伦敦: Springer,1979年,第216-226页。
Zippel, Richard. “Probabilistic Algorithms for Sparse Polynomials.” In EUROSAM ’79 Proceedings of the International Symposium on Symbolic and Algebraic Computation. London: Springer, 1979, 216–226.
本书印刷版中的索引与您的电子书页面不匹配。请使用您电子阅读设备上的搜索功能搜索您感兴趣的术语。以下列出了印刷版索引中的术语,供您参考。
The index that appeared in the print version of this title does not match the pages in your e-book. Please use the search function on your e-reading device to search for terms of interest. For your reference, the terms that appear in the print index are listed below.
阿斯米尔鲜花拍卖会
Aalsmeer Flower Auction
斯科特·阿伦森
Aaronson, Scott
诺曼·艾布拉姆森
Abramson, Norman
A/B 测试
A/B testing
戴夫·阿克利
Ackley, Dave
确认数据包(ACK)
acknowledgment packets (ACKs)
“自适应设计临床试验”
“Adaptive Design Clinical Trials”
加法增加,乘法减少(AIMD)
Additive Increase, Multiplicative Decrease (AIMD)
加法规则
Additive Rule
老化
aging
阿格拉瓦尔,马宁德拉
Agrawal, Manindra
航空旅行
air travel
阿卡迈
Akamai
算法博弈论。另请参阅博弈论
algorithmic game theory. See also game theory
算法。另请参阅具体算法和问题
algorithms. See also specific algorithms and problems
定义
defined
确定性与随机性
deterministic vs. randomized
日常问题和
everyday problems and
《爱丽丝梦游仙境》(卡罗尔)
Alice’s Adventures in Wonderland (Carroll)
al-Jabr wa'l-Muqābala (al-Khwārizmī)
al-Jabr wa’l-Muqābala (al-Khwārizmī)
艾伦,尼克
Allen, Nick
史蒂文·阿尔姆
Alm, Steven
杏仁奶
almond milk
ALOHA网络
ALOHAnet
奥特曼,萨姆
Altman, Sam
亚马逊
Amazon
“我是不是在浪费时间整理电子邮件?”(惠特克)
“Am I Wasting My Time Organizing Email?” (Whittaker)
无政府状态,代价
anarchy, price of
安德森,约翰
Anderson, John
轶事、统计数据与……
anecdotes, statistics vs.
愤怒
anger
退火
annealing
安妮(音乐剧)
Annie (musical)
安妮拿起你的枪(音乐剧)
Annie Get Your Gun (musical)
安萨里,阿齐兹
Ansari, Aziz
预期包裹运输
anticipatory package shipping
蚂蚁
ants
寻找公寓
apartment hunting
申请人库
applicant pool
阿基米德
Archimedes
建筑师
architects
亚里士多德
Aristotle
阿帕网
ARPANET
人工神经网络
artificial neural networks
“疾病与先前摄入新奇食物的关系” (Revusky 和 Bedarf)
“Association of Illness with Prior Ingestion of Novel Foods” (Revusky and Bedarf)
里克·阿斯特利
Astley, Rick
美国电话电报公司
AT&T
大西洋月刊
Atlantic Monthly
Atlas超级计算机
Atlas supercomputer
原子弹
atomic bomb
拍卖
auctions
荷兰语或降序
Dutch or descending
英语或升序
English or ascending
信息级联和
information cascades and
密封投标第一价格
sealed-bid first-price
密封投标第二价格或维克里
sealed-bid second-price or Vickrey
奥斯汀,简
Austen, Jane
平均规则
Average Rule
阿夫托·伏尔加公司
AvtoVAZ company
秘密渠道
backchannels
背景噪音
background noise
细菌突变
bacterial mutations
带宽、延迟与
bandwidth, latency vs.
带宽下降
bandwidth drops
保罗·巴兰
Baran, Paul
巴纳德,切斯特
Barnard, Chester
罗伯特·巴特利特
Bartlett, Robert
篮球
basketball
批处理
batch processing
珍妮特·巴维拉斯
Bavelas, Janet
贝叶斯,托马斯牧师
Bayes, Rev. Thomas
贝叶斯规则
Bayes’s Rule
定义
defined
英国广播公司
BBC
BBC新闻
BBC News
美丽心灵,A(纳萨尔)
Beautiful Mind, A (Nasar)
美丽
beauty
埃尔文·贝达夫
Bedarf, Erwin
贝拉迪·拉斯洛《莱斯》
Bélády, László “Les”
Bélády算法
Bélády’s Algorithm
里克·贝卢
Belew, Rik
贝尔,亚历山大·格雷厄姆
Bell, Alexander Graham
钟形曲线
bell curve
理查德·贝尔曼
Bellman, Richard
贝洛斯,梅根
Bellows, Meghan
贝尔蒙特报告
Belmont Report
基准
benchmarks
鲍里斯·别列佐夫斯基
Berezovsky, Boris
伯克利,乔治主教
Berkeley, Bishop George
柏林墙
Berlin Wall
伯纳德·克劳德
Bernard, Claude
贝瑞,唐
Berry, Don
最佳表现
best-case performance
杰夫·贝佐斯
Bezos, Jeff
大数据
big data
大O符号。另请参阅常数时间;指数时间;阶乘时间;对数时间;线性时间;多项式时间;二次时间
Big-O notation. See also constant time; exponential time; factorial time; linearithmic time; linear time; polynomial time; quadratic time
十大联盟
Big Ten conference
比克钱达尼,苏希尔
Bikhchandani, Sushil
账单支付时间表
bill-paying schedule
必应
Bing
肯·宾莫尔
Binmore, Ken
出生率,男性 vs. 女性
births, male vs. female
比特币
Bitcoin
“盲目变异和选择性保留”(坎贝尔)
“Blind Variation and Selective Retention” (Campbell)
阻塞
blocking
布鲁姆,伯顿 H.
Bloom, Burton H.
彭博商业周刊
Bloomberg Businessweek
布隆过滤器
Bloom filter
布卢姆,阿夫里姆
Blum, Avrim
列昂尼德·博古斯拉夫斯基
Boguslavsky, Leonid
装订
bookbinding
布克,克里斯托弗
Booker, Christopher
分组锦标赛
bracket tournaments
兹德涅克·布拉达奇
Bradáč, Zdeněk
破缺对称性
breaking symmetry
亨利·布莱顿
Brighton, Henry
泡沫、金融
bubbles, financial
冒泡排序
Bubble Sort
桶排序
Bucket Sort
缓冲区膨胀
bufferbloat
缓冲区
buffers
布冯、乔治·路易斯·勒克莱尔伯爵
Buffon, George-Louis Leclerc, Comte de
防盗问题
burglar problem
亚瑟·伯克斯
Burks, Arthur
业务。另请参阅秘书问题
business. See also secretary problem
过度拟合和
overfitting and
促销
promotions
每周会议
weekly meetings
彼得·布克斯顿
Buxtun, Peter
拜占庭将军问题
Byzantine generals problem
卡贝尔,詹姆斯·布兰奇
Cabell, James Branch
缓存驱逐
cache eviction
缓存未命中
cache misses
缓存
caches
定义
defined
层次结构和多任务处理
hierarchies of, and multitasking
速度
speed of
缓存
caching
缓存算法(替换或驱逐策略)
caching algorithms (replacement or eviction policies)
结石
calculus
卡利马科斯
Callimachus
唐纳德·坎贝尔
Campbell, Donald
基数
cardinal numbers
职业选择
career choices
卡罗尔·刘易斯。参见查尔斯·路特维奇·道奇森
Carroll, Lewis. See Dodgson, Charles Lutwidge
汽车
cars
事故和
accidents and
停車處
parking
自动驾驶
self-driving
交通和
traffic and
劳拉·卡斯滕森
Carstensen, Laura
皇家赌场
Casino Royale
绝对命令
categorical imperative
罗伯特·考德雷
Cawdrey, Robert
手机
cell phone
瑟夫,文顿“文特”
Cerf, Vinton “Vint”
确定性。另请参阅不确定性
certainty. See also uncertainty
慈善事业
charity
柴郡,斯图尔特
Cheshire, Stuart
棋
chess
童年
childhood
诺姆·乔姆斯基
Chomsky, Noam
丘吉尔,温斯顿
Churchill, Winston
电路交换
circuit switching
千里眼
clairvoyance
临床试验
clinical trials
衣柜,整理
closet, organizing
科巴姆,艾伦
Cobham, Alan
科巴姆-埃德蒙兹论题
Cobham-Edmonds thesis
乔治·考克饶夫(卢克·莱因哈特)
Cockcroft, George (Luke Rhinehart)
椰子水
coconut water
认知能力下降
cognitive decline
巧合
coincidences
硬币
coins
教派
denominations
双头抛掷
two-headed tosses
整理者
collators
承诺问题
commitment problem
沟通。另请参阅语言;网络;讲故事
communications. See also language; networking; storytelling
确认
confirmation
先验和
priors and
社区支持农业(CSA)
community-supported agriculture (CSA)
比较计数排序
Comparison Counting Sort
比价购物网站
comparison-shopping websites
复杂
complexity
惩罚
penalizing
计算,由图灵定义
computation, defined by Turing
计算善意
computational kindness
置信区间
confidence interval
确认
confirmation
拥塞
congestion
避免
avoidance of
无政府状态的代价和
price of anarchy and
连接机
Connection Machine
恒定时间(O (1))
constant-time (O(1))
约束优化问题
constrained optimization problems
约束问题,偏好
constrained problem, preferences for
约束放松
Constraint Relaxation
建设项目
construction projects
内容分发网络(CDN)
content distribution networks (CDNs)
上下文切换
context switching
连续优化问题
continuous optimization problems
持续放松
Continuous Relaxation
无等级制控制
control without hierarchy
库珀,马丁
Cooper, Martin
合作
cooperation
哥白尼原理
Copernican Principle
哥白尼,尼古拉
Copernicus, Nicolaus
企业营销
corporate marketing
成本效益分析
cost-benefit analysis
吉姆·克莱默
Cramer, Jim
领结系统
Cravath system
创造力
creativity
可丽饼摊排队
crêpe stand queue
交叉验证
Cross-Validation
密码学
cryptography
客户服务等待时间
customer service hold times
查尔斯·达尔文
Darwin, Charles
数据。另请参阅大数据;小数据
data. See also big data; small data
偶像崇拜
idolatry of
过度拟合和
overfitting and
从单点预测
predicting from single point
约会。参见爱情;婚姻
dating. See love; marriage
戴维斯,莉迪亚
Davis, Lydia
理查德·道金斯
Dawkins, Richard
截止日期
deadlines
死亡诗社(电影)
Dead Poets Society (film)
一掷千金(电视节目)
Deal or No Deal (TV show)
债务雪崩
debt avalanche
债务雪球
debt snowball
分散系统
decentralized systems
决策
decision-making
计算善良和
computational kindness and
提前停止和
Early Stopping and
过度拟合和
overfitting and
现实世界的捷径
real-world shortcuts
什么时候应该少想
when to think less
解密
decryption
交叉
decussation
叛逃
defection
国防军官人事管理法
Defense Officer Personnel Management Act
拒绝服务攻击
denial of service attack
彼得·丹宁
Denning, Peter
设备缓冲区
device buffers
骰子人(莱因哈特)
Dice Man, The (Rhinehart)
字典攻击
dictionary attack
安妮·迪拉德
Dillard, Annie
折扣函数
discount function
离散优化
discrete optimization
离散放松技巧(亨德森)
Discrete Relaxation Techniques (Henderson)
位移
displacement
分布。另请参阅特定类型
distributions. See also specific types
道奇森,查尔斯·路特维奇(刘易斯·卡罗尔)
Dodgson, Charles Lutwidge (Lewis Carroll)
统治等级
dominance hierarchies
主导策略
dominant strategies
诚实作为
honesty as
囚徒困境和叛逃
prisoner’s dilemma and defection as
掉球
dropped balls
吸毒成瘾
drug addiction
药物试验
drug trials
杜普伊,贝丝
Dupuis, Beth
比尔·杜瓦尔
Duvall, Bill
汤姆·德万
Dwan, Tom
动态分配。参见Gittins 索引
dynamic allocation. See Gittins Index
动态层次结构
dynamic hierarchies
“绩效评估的不良后果”(Ridgway)
“Dysfunctional Consequences of Performance Measurements” (Ridgway)
耳朵
ear
最早到期日
Earliest Due Date
提前停止
Early Stopping
吃掉那只青蛙!(特蕾西)
Eat That Frog! (Tracy)
赫尔曼·艾宾浩斯
Ebbinghaus, Hermann
ECMO(体外膜肺氧合)
ECMO (extracorporeal membrane oxygenation)
经济学。另请参阅拍卖;投资策略;市场行为
economics. See also auctions; investment strategies; market behavior
气泡
bubbles
纳什均衡和
Nash equilibrium and
公地悲剧和
tragedy of commons and
经济学家
Economist
埃德蒙兹,杰克
Edmonds, Jack
教育评估
educational evaluation
沃德·爱德华兹
Edwards, Ward
高效算法
efficient algorithm
有效或易处理的问题,定义
efficient or tractable problem, defined
埃及法老的统治
Egyptian pharaohs’ reigns
电记忆器官
electrical memory organ
电梯演讲
elevator pitch
电子邮件
情绪
emotions
恩格尔,乔尔
Engel, Joel
布莱恩·伊诺
Eno, Brian
环保运动
environmental movement
流行病学
epidemiology
平等
equality
平衡
equilibrium
埃尔朗,阿格纳·克拉鲁普
Erlang, Agner Krarup
Erlang 分布
Erlang distribution
误差线
error bars
误差权衡空间
error tradeoff space
伦理
ethics
印象笔记
Evernote
驱逐政策
eviction policies
进化
evolution
约束和
constraints and
预期值
expected value
显式拥塞通知 (ECN)
Explicit Congestion Notification (ECN)
探索/利用权衡
explore/exploit tradeoff
指数退避
Exponential Backoff
指数时间(O (2 n ))
exponential time (O(2n))
阶乘时间(O(n!))
factorial time (O(n!))
时尚
fads
误报
false positives
联邦调查局
FBI
FCC频谱拍卖
FCC spectrum auctions
FDA
FDA
反馈
feedback
击剑
fencing
备案
filing
芬克尔,拉里
Finkel, Larry
火狐
Firefox
消防车问题
fire truck problem
先进先出(FIFO)
First-In, First-Out (FIFO)
健康
fitness
菲茨杰拉德,F·斯科特
Fitzgerald, F. Scott
杰西卡·弗莱克
Flack, Jessica
闪存
flash memory
扁平层级结构
flat hierarchies
弗勒德·梅里尔
Flood, Merrill
流量控制
flow control
食物
food
时尚
fads
尽量减少腐烂
minimizing rotten
过度拟合和
overfitting and
《福布斯》
Forbes
遗忘曲线
forgetting curve
饶恕
forgiveness
福斯特,EM
Forster, E. M.
财富500强榜单
Fortune 500 list
弗兰克·罗伯特
Frank, Robert
富兰克林,本杰明
Franklin, Benjamin
弗雷德里克森,芭芭拉
Fredrickson, Barbara
弗里德,杰森
Fried, Jason
完全信息博弈
full-information games
最佳停止和
optimal stopping and
基本面投资者
fundamental investors
未来,折扣
future, discounted
伽利略
Galileo
赌博
gambling
博弈论
game theory
赌博
gaming
亨利·甘特
Gantt, Henry
甘特图
Gantt charts
加德纳,马丁
Gardner, Martin
盖斯凯尔,RE
Gaskell, R. E.
高斯,卡尔·弗里德里希
Gauss, Carl Friedrich
丹·盖拉特
Gelatt, Dan
地理
geography
几何贴现
geometric discounting
乔治·萨米
George, Sammy
德国坦克问题
German tanks problem
完成重要的事情
getting important things done
完成任务
getting things done
把事情做好(艾伦)
Getting Things Done (Allen)
吉姆·盖蒂斯
Gettys, Jim
格尔德·吉格伦泽
Gigerenzer, Gerd
吉尔伯特·丹尼尔
Gilbert, Daniel
金斯伯格,艾伦
Ginsberg, Allen
吉廷斯,约翰
Gittins, John
吉廷斯指数
Gittins index
直接捐赠
GiveDirectly
巴里·格拉斯纳
Glassner, Barry
安德鲁·格里森
Gleason, Andrew
全局最大值
global maximum
目标,明确
goals, explicit
教父
Godfather
教父(电影)
Godfather, The (film)
约翰·沃尔夫冈·冯·歌德
Goethe, Johann Wolfgang von
赫尔曼·戈德斯坦
Goldstine, Herman
“足够好”的解决方案
“good enough” solutions
谷歌
艾莉森·戈普尼克
Gopnik, Alison
戈登,黛博拉
Gordon, Deborah
戈特,J.理查德三世
Gott, J. Richard, III
古尔德,斯蒂芬·杰伊
Gould, Stephen Jay
政府
government
《伟人、伟大的思想和环境》(詹姆斯)
“Great Men, Great Thoughts, and the Environment” (James)
贪婪算法
greedy algorithm
斯蒂芬·格雷莱特
Grellet, Stephen
戴夫·格罗斯曼
Grossman, Dave
监护人
Guardian
吉尼斯世界纪录
Guinness Book of World Records, The
枪支暴力
gun violence
停机问题
halting problem
杰夫·哈默巴赫
Hammerbacher, Jeff
汉森,大卫·海涅迈尔
Hansson, David Heinemeier
加勒特·哈丁
Hardin, Garrett
哈迪,GH
Hardy, G. H.
哈克斯顿,艾萨克
Haxton, Isaac
医疗改革
health care reform
米奇·赫德伯格
Hedberg, Mitch
轩尼诗,约翰
Hennessy, John
从众行为
herd behavior
启发式
heuristics
等级制度。参见支配等级制度;动态等级制度;扁平等级制度
hierarchies. See dominance hierarchies; dynamic hierarchies; flat hierarchies
免费停车费用高昂(Shoup)
High Cost of Free Parking, The (Shoup)
爬山
Hill Climbing
随机重启或霰弹枪
Random-Restart or Shotgun
丹尼·希利斯
Hillis, Danny
大卫·赫什莱弗
Hirshleifer, David
何乔丹
Ho, Jordan
大卫·霍夫曼
Hoffman, David
赫尔曼·霍勒里斯
Hollerith, Herman
霍尔瑞斯机
Hollerith Machine
主页、缓存和
home, caching and
诚实
honesty
胡佛水坝
Hoover Dam
希望
HOPE
霍斯肯,JC
Hosken, J. C.
小时费率
hourly rate
房屋出售
house selling
房地产泡沫
housing bubble
人类
humans
复杂性惩罚和
complexity penalty and
创造力和
creativity and
耳朵设计
ear design
探索/利用和
explore/exploit and
时尚与传统
fads vs. tradition and
流量控制和
flow control and
寿命
life spans of
记忆和
memory and
神经系统设计
nervous system design
时间成本和
time costs and
休谟,大卫
Hume, David
IBM
IBM
冰-T
Ice-T
“如果——”(吉卜林)
“If—” (Kipling)
宜家
IKEA
重要性,优先处理任务
importance, prioritizing tasks by
不可能的事情变成了惩罚
impossibilities, turned into penalties
不可能的结果
impossibility result
不作为、不可撤销
inaction, irrevocability of
激励结构
incentive structures
收入分配
income distributions
工业事故
industrial accidents
信息。另请参阅完全信息博弈;无信息博弈
information. See also full-information games; no-information games
信息级联
information cascades
信息层次结构
information hierarchies
信息处理
information processing
插入排序
Insertion Sort
国际商业时报
International Business Times
互联网。另请参阅带宽、延迟与;网络;网站。
Internet. See also bandwidth, latency vs.; networking; websites
快速连接
fast connections
地理
geography of
基础设施
infrastructure of
协议和
protocols and
安全和
security and
中断合并
interrupt coalescing
中断
interruptions
棘手的问题
intractable problems
定义
defined
平衡和
equilibrium and
放松和
relaxation and
调度和
scheduling and
放松方法简介,安(肖)
Introduction to Relaxation Methods, An (Shaw)
直觉的猜测
intuitive hunches
投资策略
investment strategies
邀请
invitations
非自愿的无私
involuntary selflessness
范·雅各布森
Jacobson, Van
贾恩·卡马尔
Jain, Kamal
詹姆斯·威廉
James, William
贾维斯,理查德
Jarvis, Richard
大白鲨(电影)
Jaws (film)
杰伊·弗朗辛
Jay, Francine
哈罗德·杰弗里斯
Jeffreys, Harold
喷气推进实验室(JPL)
Jet Propulsion Laboratory (JPL)
抖动
jitter
乔布斯,史蒂夫
Jobs, Steve
求职
job search
约翰逊·塞尔默
Johnson, Selmer
琼斯,威廉
Jones, William
少即是多(杰伊)
Joy of Less, The (Jay)
判断
judgment
“只玩游戏”方法
“just play the game” approach
公正社会
just society
莱斯利·凯尔布林
Kaelbling, Leslie
卡恩,罗伯特“鲍勃”
Kahn, Robert “Bob”
康德,伊曼纽尔
Kant, Immanuel
卡雷尔斯,迈克尔
Karels, Michael
卡普,理查德
Karp, Richard
考希克,阿维纳什
Kaushik, Avinash
卡亚尔·尼拉杰
Kayal, Neeraj
济慈,约翰
Keats, John
保留找到的物品(琼斯)
Keeping Found Things Found (Jones)
肯尼,理查德
Kenney, Richard
开普勒,约翰尼斯
Kepler, Johannes
克尔·克拉克
Kerr, Clark
凯恩斯,约翰·梅纳德
Keynes, John Maynard
花剌子密
al-Khwārizmī
金县图书馆系统(KCLS)
King County Library System (KCLS)
山丘之王
king of the hill
吉卜林,鲁德亚德
Kipling, Rudyard
斯科特·柯克帕特里克
Kirkpatrick, Scott
莱昂纳德·克莱因罗克
Kleinrock, Leonard
克莱恩,查理
Kline, Charley
背包问题
knapsack problem
克努斯,唐纳德
Knuth, Donald
皮特·库曼
Koomen, Pete
阶梯锦标赛
Ladder tournaments
拉格朗日,约瑟夫-路易斯
Lagrange, Joseph-Louis
拉格朗日松弛
Lagrangian Relaxation
黎子良
Lai, Tze Leung
柳叶刀肝吸虫
lancet liver fluke
兰格,丽贝卡
Lange, Rebecca
语言
language
老子
Lao Tzu
皮埃尔·西蒙·拉普拉斯
Laplace, Pierre-Simon
拉普拉斯定律
Laplace’s Law
套索
Lasso
延迟
latency
迟到,最小化最大
lateness, minimizing maximum
洗衣店
laundry
执法
law enforcement
劳勒,尤金“吉恩”
Lawler, Eugene “Gene”
《草地网球锦标赛》(道奇森)
“Lawn Tennis Tournaments” (Dodgson)
总吨位法
Law of Gross Tonnage
劳伦斯,彼得 A.
Lawrence, Peter A.
劳伦斯伯克利实验室(LBL)
Lawrence Berkeley Laboratory (LBL)
诉讼
lawsuits
拉扎里尼,马里奥
Lazzarini, Mario
最近最少使用(LRU)
Least Recently Used (LRU)
李·迈克尔
Lee, Michael
左侧插入规则
left-side insertion rule
勒奎恩,厄休拉 K.
Le Guin, Ursula K.
兰斯特拉,扬·卡雷尔
Lenstra, Jan Karel
勒纳,本
Lerner, Ben
调平
leveling
自由
liberty
利宾,菲尔
Libin, Phil
图书馆
libraries
可能性
likelihood
同类分组
like-with-like grouping
林肯·亚伯拉罕
Lincoln, Abraham
线性对数时间(O ( n log n ))
linearithmic time (O(n log n))
线性时间(O(n))
linear time (O(n))
语言学
linguistics
Linux
Linux
龙虾笼
lobster trap
局部最大值
local maximum
对数率
logarithmic rates
智胜
outsmarting
先看后跳规则
Look-Then-Leap Rule
洛斯阿拉莫斯
Los Alamos
洛杉矶时报
Los Angeles Times
爱情。另见婚姻
love. See also marriage
约会和
dating and
博弈论和
game theory and
挖金子 vs.
gold digging vs.
回忆场景
recall scenario
拒绝场景
rejection scenario
斯蒂芬·卢丁
Ludin, Stephen
萨尔瓦多卢里亚
Luria, Salvador
马赫,恩斯特
Mach, Ernst
萨尔瓦托·马加迪诺
Magaddino, Salvatore
美国职业棒球大联盟
Major League Baseball
苍蝇的制作(劳伦斯)
Making of a Fly, The (Lawrence)
马尔萨斯,托马斯
Malthus, Thomas
曼哈顿计划
Manhattan Project
人员配备控制
manning control
马拉松
marathon
疯狂三月
March Madness
海上通行权
maritime right-of-way
市场行为。另请参阅拍卖;金融泡沫;经济学;投资策略
market behavior. See also auctions; bubbles, financial; economics; investment strategies
哈里·马科维茨
Markowitz, Harry
婚姻。另见爱情
marriage. See also love
交叉验证和
Cross-Validation and
达尔文的利弊清单和
Darwin’s pro-con list and
生活满意度模型
life satisfaction models
囚徒困境和
prisoner’s dilemma and
棉花糖测试
marshmallow test
火星探路者
Mars Pathfinder
匹配算法
matching algorithms
麦克莱,劳拉·艾伯特
McLay, Laura Albert
均值方差投资组合优化
mean-variance portfolio optimization
机械复制
mechanical reproduction
机制设计
mechanism design
诚实作为目标
honesty as goal of
媒体
media
安德鲁·梅伦
Mellen, Andrew
内存层次结构
memory hierarchy
无记忆分布
memoryless distributions
内存管理
memory management
记忆墙
memory wall
卡尔·门格尔
Menger, Karl
归并排序
Mergesort
梅尔特斯,米卡
Mertes, Micah
混乱
mess
搜索排序权衡
search-sort tradeoff
自组织
self-organizing
排序和
sorting and
代谢
metabolism
元工作
metawork
指标
metrics
过度拟合和
overfitting and
代理人
proxy
调度和
scheduling and
大都会,尼古拉斯
Metropolis, Nicholas
大都会算法
Metropolis Algorithm
迈耶,马蒂亚斯
Meyer, Mathias
迈耶,罗伯特
Meyer, Robert
保罗·米尔格罗姆
Milgrom, Paul
军队
military
通讯和
communications and
训练伤疤和
training scars and
约翰·斯图尔特·密尔
Mill, John Stuart
米勒,加里
Miller, Gary
米勒-拉宾素数检验
Miller-Rabin primality test
最小切片
minimum slice
最小生成树
minimum spanning tree
亨利·明茨伯格
Mintzberg, Henry
沃尔特·米歇尔
Mischel, Walter
迈克尔·米岑马赫
Mitzenmacher, Michael
蒙特卡罗方法
Monte Carlo Method
戈登·摩尔
Moore, Gordon
摩尔算法
Moore’s Algorithm
摩尔定律
Moore’s Law
朱莉·摩根斯坦
Morgenstern, Julie
莫尔斯,塞缪尔 FB
Morse, Samuel F. B.
次贷危机
mortgage crisis of
莫泽,利奥
Moser, Leo
弗雷德里克·莫斯特勒
Mosteller, Frederick
电影
movies
票房收入和
box-office grosses and
运行时间和
running times and
续集和
sequels and
莫扎特,沃尔夫冈·阿马德乌斯
Mozart, Wolfgang Amadeus
多臂老虎机
multi-armed bandits
乘法规则
Multiplicative Rule
多任务处理
multitasking
谋杀率
murder rate
墨菲,汤姆
Murphy, Tom
迈尔森,罗杰
Myerson, Roger
近视算法
myopic algorithm
中村光
Nakamura, Hikaru
纳什,约翰
Nash, John
纳什均衡
Nash equilibrium
国家图书馆分类冠军
National Library Sorting Champion
自然
Nature
NBA
NBA
NCAA
NCAA
神经系统
nervous system
Netflix
Netflix
网络。另请参阅互联网
networking. See also Internet
网络队列
network queues
克里斯托夫·诺伊曼
Neumann, Christof
神经网络
neural networks
新闻报道
news reports
艾萨克·牛顿
Newton, Isaac
纽约公共图书馆(NYPL)
New York Public Library (NYPL)
《纽约时报》
New York Times
尼科尔斯,凯瑟琳
Nichols, Kathleen
尼采,弗里德里希
Nietzsche, Friedrich
九因素模型
nine-factor models
尼散,诺姆
Nisan, Noam
野口由纪夫
Noguchi, Yukio
野口文件系统
Noguchi Filing System
无信息游戏
no-information games
噪音
noise
正态分布
normal distribution
彼得·诺维格
Norvig, Peter
永不放弃
not giving up, ever
现在习惯(Fiore)
Now Habit, The (Fiore)
核反应
nuclear reactions
核战争
nuclear war
奥巴马、巴拉克
Obama, Barack
斜向策略
Oblique Strategies
奥卡姆剃刀
Occam’s razor
入住率
occupancy rate
石油权拍卖
oil rights auctions
寡头(霍夫曼)
Oligarchs, The (Hoffman)
奥运会
Olympics
单因素模型
one-factor models
单向函数
one-way function
《物种起源》(达尔文)
On the Origin of Species (Darwin)
最优停止
optimal stopping
“三倍或零”
“triple-or-nothing” and
乐观
optimism
优化问题
optimization problems
难以解决,定义
intractable, defined
随机性和
randomness and
放松和
relaxation and
顺序,成本。另请参阅排序
order, cost of. See also sorting
序数
ordinal numbers
由内而外的组织(摩根斯坦)
Organizing from the Inside Out (Morgenstern)
奥尔特加·加塞特,何塞
Ortega y Gasset, José
结果、过程与……
outcome, process vs.
过度拟合
overfitting
数据包确认。另请参阅确认数据包 (ACK)
packet acknowledgment. See also acknowledgment packets (ACKs)
数据包丢失
packet drops
数据包路由
packet routing
分组交换
packet switching
页面错误
page faults
页面浏览量,测量
page views, measuring
帕尔默,TH
Palmer, T. H.
帕帕迪米特里奥,克里斯托斯
Papadimitriou, Christos
尼尔·帕普沃思
Papworth, Neil
寄生虫
parasites
停车场
parking lots
停车收费表
parking meters
寻找停车位
parking spot hunt
帕斯卡·布莱斯
Pascal, Blaise
密码失败
password failures
啄食顺序
pecking orders
青霉菌
Penicillium mold
笔尺寸
pen size
完美的解决方案
perfect solution
性能测量
performance measurements
佩里,凯蒂
Perry, Katy
彼得,劳伦斯 J.
Peter, Laurence J.
彼得原理
Peter Principle
关于概率的哲学论文
Philosophical Essay on Probabilities
pi ( π ),估计值
pi (π), estimating value of
鸽子
pigeons
堆,自组织
piles, self-organizing
ping攻击
ping attack
罗杰·平克汉姆
Pinkham, Roger
罗伯特·皮尔西格
Pirsig, Robert
叉
Pitchfork
必胜客
Pizza Hut
斯科特·普拉根霍夫
Plagenhoef, Scott
胜者为王算法
play-the-winner algorithms
诗
poetry
亨利·庞加莱
Poincaré, Henri
扑克
poker
小心
heads-up
无限制
no-limit
政治运动
political campaigns
多项式恒等式检验
polynomial identity testing
多项式时间(O ( n² )、O ( n³ )等)
polynomial time (O(n2), O(n3), etc.)
番茄钟
pomodoros
受欢迎程度
popularity
投资组合管理
portfolio management
邮政邮件
postal mail
邮政信使问题
postal messenger problem
幂律分布
power-law distributions
普拉巴卡尔·巴拉吉
Prabhakar, Balaji
普拉特,沃恩
Pratt, Vaughan
优先约束
precedence constraints
预测。另请参阅贝叶斯规则;哥白尼原理
prediction. See also Bayes’s Rule; Copernican Principle
决策
decision making as
提前停止和
Early Stopping and
数据崇拜和
idolatry of data and
媒体对
influence of media on
过度拟合和
overfitting and
先验分布和
prior distributions and
抢占
preemption
先前存在的信念
preexisting beliefs
偏好
preferences
优先依附
preferential attachment
普雷斯顿分拣中心
Preston Sort Center
普莱斯,理查德
Price, Richard
无政府状态的代价
price of anarchy
素数测试
primality testing
证人
witness against
素数
prime numbers
公主新娘(电影)
Princess Bride, The (film)
《心理学原理》(詹姆斯)
Principles of Psychology (James)
优先级继承
priority inheritance
优先级反转
priority inversion
先验概率或先验
prior probabilities or priors
普通的
normal
幂律
power-law
逆向工程
reverse-engineering
制服
uniform
不具信息量
uninformative
囚徒困境
Prisoner’s Dilemma
违反缓刑规定
probation violations
问题。另见棘手问题
problems. See also intractable problems
定义棘手
defining intractable
采摘
picking
过程、结果与……
process, outcome vs.
处理器周期
processor cycles
拖延
procrastination
项目管理
project management
优缺点列表
pros and cons list
协议
protocols
谚语
proverbs
柯克·普鲁斯
Pruhs, Kirk
打孔卡
punch cards
购买选择
purchasing choices
普京、弗拉基米尔
Putin, Vladimir
二次时间(O(n² ))
quadratic time (O(n2))
突破障碍
breaking barrier
排队
queueing
见好就收
quitting while you’re ahead
拉宾,迈克尔
Rabin, Michael
种族与斗争
race vs. fight
抽奖问题
raffle problem
拉姆斯卡,迈克尔
Ramscar, Michael
“随机文章”链接
“Random article” link
随机驱逐
Random Eviction
随机算法
randomized algorithms
随机性
randomness
使用量
how much to use
网络和打破对称性
networking and breaking symmetry and
随机重启
random restarts
拉波波特,阿姆农
Rapoport, Amnon
拉斯金,阿扎
Raskin, Aza
罗尔斯,约翰
Rawls, John
实时分析
real-time analytics
回忆场景
recall scenario
食谱
recipes
递归
recursion
引诱对手
luring opponent into
削减策略
strategies that cut
红木森林
redwood forest
格伦·里夫斯
Reeves, Glenn
后悔,尽量减少
regret, minimizing
正则化
Regularization
拒绝
rejection
松弛
relaxation
随机性与
randomness vs.
宗教法
religious laws
更换政策
replacement policies
响应能力-吞吐量权衡
responsiveness-throughput tradeoff
餐厅
restaurant
选择
choice of
开放座位和
open seating and
不安分的强盗
restless bandit
苏珊娜·罗伊廷格
Reuttinger, Susanna
启示原则
revelation principle
复仇
revenge
收入等价原则
revenue equivalence principle
逆向工程先验分布
reverse-engineering prior distributions
逆向博弈论
reverse game theory
雷夫斯基,塞缪尔
Revusky, Samuel
莱因哈特,卢克。参见乔治·考克饶夫
Rhinehart, Luke. See Cockcroft, George
里奇韦,VF
Ridgway, V. F.
罗恩·里维斯特
Rivest, Ron
罗宾斯,赫伯特
Robbins, Herbert
朱莉娅·罗宾逊
Robinson, Julia
鲁棒性
robustness
摇滚乐队曲目列表
rock band set list
石头剪刀布
rock-paper-scissors
罗杰斯,肯尼
Rogers, Kenny
罗姆尼,米特
Romney, Mitt
罗森鲍姆,大卫
Rosenbaum, David
拉夫加登,蒂姆
Roughgarden, Tim
循环赛
Round-Robin
瓦内萨·鲁索
Rousso, Vanessa
路线规划。另请参阅旅行商问题;假期、行程
route planning. See also traveling salesman problem; vacation, itinerary of
规则弯曲
rule bending
拉什,芭芭拉
Rush, Barbara
罗素·伯特兰
Russell, Bertrand
俄罗斯寡头
Russian oligarchs
Rybka国际象棋程序
Rybka chess program
卡尔·萨根
Sagan, Carl
采样。另请参阅随机性
sampling. See also randomness
旧金山
San Francisco
让·保罗·萨特
Sartre, Jean-Paul
萨克塞纳,尼廷
Saxena, Nitin
说不
saying no
缩放、排序和
scale, sorting and
无标度分布
scale-free distributions
调度
scheduling
埃里克·施密特
Schmidt, Eric
彼得·施密特
Schmidt, Peter
斯库勒,拉埃尔
Schooler, Lael
科学
Science
《科学美国人》
Scientific American
科学管理
Scientific Management
婴儿床里的科学家(戈普尼克)
Scientist in the Crib, The (Gopnik)
西尔,达里尔
Seale, Darryl
搜索、验证和
search, gap between verification and
搜索引擎
search engines
搜索排序权衡
search-sort tradeoff
自组织列表
self-organizing lists
第二次机会
second-chance scenario
秘书问题
secretary problem
窃贼变种
burglar variant
完整信息变体
full-information variant
回忆变体
recall variant
拒绝变体
rejection variant
播种
seeding
自私路由
selfish routing
自组织列表
self-organizing lists
顺序信息处理
sequential information processing
意外发现
serendipity
杰弗里·沙利特
Shallit, Jeffrey
萧伯纳,乔治·伯纳德
Shaw, George Bernard
施勇
Shi, Yong
约瑟夫·肖恩菲尔德
Shoenfield, Joseph
营业时间
shop hours
最短处理时间
Shortest Processing Time
未加权
unweighted
加权
weighted
唐纳德·舒普
Shoup, Donald
西伯利亚石油公司
Sibneft oil company
埃拉斯托尼筛法
Sieve of Erastothenes
硅谷
Silicon Valley
模拟退火
Simulated Annealing
弗兰克·西纳特拉
Sinatra, Frank
单淘汰赛
Single Elimination
单机调度
single-machine scheduling
丹·西罗克
Siroker, Dan
尺寸
size
统治等级和
dominance hierarchies and
内存层次结构和
memory hierarchy and
排序和
sorting and
Skype
Skype
丹尼尔·斯莱特
Sleator, Daniel
老虎机
slot machines
小数据
small data
伪装的大数据
as big data in disguise
史密斯,亚当
Smith, Adam
史密斯,丹
Smith, Dan
足球
soccer
社交媒体
social media
社交网络(电影)
Social Network, The (film)
社交网络
social networks
社会政策
social policy
袜子,分类
socks, sorting
软件,术语创造
software, term coined
固态硬盘
solid-state drives
单人纸牌
solitaire
排序
sorting
排序和搜索(Knuth)
Sorting and Searching (Knuth)
排序-搜索权衡
sort-search tradeoff
豆浆
soy milk
时空权衡
space-time tradeoffs
SpaceX
SpaceX
纺纱
spinning
运动的
sports
联盟专员
league commissioner
过度拟合和
overfitting and
赛季安排
season scheduling
锦标赛结构
tournament structures
体育赛事安排组
Sports Scheduling Group
松鼠
squirrels
静态存储器
SRAM
标准化测试
standardized tests
统计科学
Statistical Science
地位
status
啄食顺序和
pecking order and
种族与打架
races vs. fights and
斯图尔特,玛莎
Stewart, Martha
马克·斯泰弗斯
Steyvers, Mark
股票市场。另请参阅投资策略
stock market. See also investment strategies
算法交易和
algorithmic trading and
2010年的闪电崩盘
flash crash of 2010
贮存
storage
评书
storytelling
克里斯·斯图奇奥
Stucchio, Chris
完成时间总和
sum of completion times
加权完成时间总和
sum of weighted completion times
作业加权延迟总和
sum of weighted lateness of jobs
超级归档系统
super filing system
尾部丢弃
Tail Drop
塔尔多斯,埃娃
Tardos, Éva
塔尔扬,罗伯特
Tarjan, Robert
任务切换
task switching
泰勒,弗雷德里克
Taylor, Frederick
TCP 锯齿状。另请参阅传输控制协议 (TCP)
TCP sawtooth. See also Transmission Control Protocol (TCP)
应试教学
teaching to the test
技术投资者
technical investors
电报
telegraph
电话
telephone
温度
temperature
时间局部性
temporal locality
乔什·特南鲍姆
Tenenbaum, Josh
网球锦标赛
tennis tournaments
德州扑克
Texas Hold ’Em
短信
text messages
“2012 年 TeX 调优”(Knuth)
“TeX Tuneup of 2012, The” (Knuth)
感恩节商业
Thanksgiving commerce
盗窃、不合理的反应和
theft, irrational responses and
计算机科学家很少谈论的事情(Knuth)
Things a Computer Scientist Rarely Talks About (Knuth)
37%规则
37% rule
梭罗,亨利·戴维
Thoreau, Henry David
鞭笞
thrashing
线程
threading
塞伦迪普的三位王子
Three Princes of Serendip, The
阈值规则
Threshold Rule
吞吐量
throughput
蒂布希拉尼,罗伯特
Tibshirani, Robert
安德烈·吉洪诺夫
Tikhonov, Andrey
时间
time
间隔
interval of
时间盒
timeboxing
时间成本
time costs
时间管理
time management
时空权衡
time-space tradeoffs
杰克逊·托林斯
Tolins, Jackson
雷·汤姆林森
Tomlinson, Ray
城镇规模分布
town size distributions
弓形虫
Toxoplasma gondii
交通
traffic
公地悲剧
tragedy of the commons
训练伤疤
training scars
交通系统
transit systems
传输控制协议 (TCP)
Transmission Control Protocol (TCP)
ACK 和
ACKs and
秘密渠道和
backchannels and
流量控制和
flow control and
无政府状态的代价和
price of anarchy and
旅行商问题
traveling salesman problem
特里特,泰勒
Treat, Tyler
《论事件原因的概率》(拉普拉斯)
“Treatise on the Probability of the Causes of Events” (Laplace)
树,吉恩·福克斯
Tree, Jean Fox
特里克,迈克尔
Trick, Michael
三次握手
triple handshake
三倍或零游戏
triple-or-nothing game
旅行计划。另请参阅旅行商问题
trip planning. See also traveling salesman problem
图灵,艾伦
Turing, Alan
图灵机
Turing machine
轮流
turn-taking
塔斯基吉梅毒研究
Tuskegee Syphilis Study
特沃斯基,阿莫斯
Tversky, Amos
马克·吐温
Twain, Mark
孪生素数
twin primes
叽叽喳喳
双因素模型
two-factor models
双机调度
two-machine scheduling
加州大学伯克利分校
UC Berkeley
乌拉姆,斯坦尼斯拉夫“斯坦”
Ulam, Stanislaw “Stan”
艾伦·厄尔曼
Ullman, Ellen
不确定
uncertainty
联合利华
Unilever
《数据的不合理有效性》(诺维格)
“Unreasonable Effectiveness of Data, The” (Norvig)
“不晋升就离开”制度
“up or out” system
置信上限
Upper Confidence Bound
城市规划师
urban planners
美国武装部队
US Armed Forces
美国人口普查
US Census
美国众议院
US House of Representatives
美国公共卫生服务
US Public Health Service
掉头
U-turns
假期
vacation
电子邮件和
email and
行程
itinerary of
政策
policy on
疫苗接种
vaccination
阿尔弗雷德·韦尔
Vail, Alfred
衣帽架
valet stand
无知之幕
veil of ignorance
验证、搜索和
verification, gap between search and
维克里,威廉
Vickrey, William
维克里拍卖
Vickrey auction
维塔可可
Vita Coco
语音信箱
voicemail
语音传输、互联网
voice transmission, Internet
伏尔泰
Voltaire
冯·诺依曼,约翰
Von Neumann, John
瓦根梅克斯,E.-J.
Wagenmakers, E.-J.
理查德·瓦格纳
Wagner, Richard
等待,成本效益
waiting, cost-benefit of
《行走》(梭罗)
“Walking” (Thoreau)
沃波尔,贺拉斯
Walpole, Horace
战争
war
吉姆·韦尔
Ware, Jim
安迪·沃霍尔
Warhol, Andy
华盛顿之星
Washington Star
财富
wealth
网页设计
web design
网站。另请参阅互联网
websites. See also Internet
广告和
advertising and
“Akamaized”
“Akamaized”
指数退避和
Exponential Backoff and
恶意
malicious
婚礼座位表
wedding seating plan
艾玛·韦奇伍德
Wedgwood, Emma
加权策略
weighted strategies
伊沃·韦尔奇
Welch, Ivo
惠特尼·哈斯勒
Whitney, Hassler
史蒂夫·惠特克
Whittaker, Steve
彼得·惠特尔
Whittle, Peter
维基百科
Wikipedia
莫里斯·威尔克斯
Wilkes, Maurice
威廉姆斯,罗宾
Williams, Robin
赢则留,输则换
Win-Stay, Lose-Shift
无线网络
wireless networking
智慧
wisdom
妄想
wishful thinking
路德维希·维特根斯坦
Wittgenstein, Ludwig
工作时间
work hours
第二次世界大战
World War II
最坏情况分析
worst-case analysis
赖特,史蒂文
Wright, Steven
X档案(电视剧)
X-Files, The (TV show)
叶利钦,鲍里斯
Yeltsin, Boris
维克多·英格韦
Yngve, Victor
杨·迪恩
Young, Dean
泽伦·马文
Zelen, Marvin
Zelen算法
Zelen algorithm
禅与摩托车维修艺术(Pirsig)
Zen and the Art of Motorcycle Maintenance (Pirsig)
Python 之禅
Zen of Python, The
零和
zero-sum
零零期权
zero-zero option
彼得·泽尔斯特拉
Zijlstra, Peter
Z顺序
Z-order
首先,感谢抽出时间与我们坐下来讨论他们的工作和更广阔观点的研究人员、从业人员和专家:Dave Ackley、Steve Albert、John Anderson、Jeff Atwood、Neil Bearden、Rik Belew、Donald Berry、Avrim Blum、Laura Carstensen、Nick Chater、Stuart Cheshire、Paras Chopra、Herbert Clark、Ruth Corbin、Robert X. Cringely、Peter Denning、Raymond Dong、Elizabeth Dupuis、Joseph Dwyer、David Estlund、Christina Fang、Thomas Ferguson、Jessica Flack、James Fogarty、Jean E. Fox Tree、Robert Frank、Stuart Geman、Jim Gettys、John Gittins、Alison Gopnik、Deborah Gordon、Michael Gottlieb、Steve Hanov、Andrew Harbison、Isaac Haxton、John Hennessy、Geoff Hinton、David Hirshliefer、Jordan Ho、Tony Hoare、Kamal Jain、Chris Jones、William琼斯、莱斯利·凯尔布林、大卫·卡格尔、理查德·卡普、斯科特·柯克帕特里克、拜伦·诺尔、康·科利瓦斯、迈克尔·李、扬·卡雷尔·伦斯特拉、保罗·林奇、普雷斯顿·迈克菲、杰伊·麦克莱兰、劳拉·阿尔伯特·麦克莱、保罗·米尔格罗姆、安东尼·米兰达、迈克尔·米岑马赫、罗斯玛丽·纳格尔、克里斯托夫·诺伊曼、诺姆·尼桑、野口幸雄、彼得·诺维格、克里斯托斯·帕帕迪米特里乌、梅根·彼得森、斯科特·普拉根霍夫、安妮塔·波梅兰茨、巴拉吉·普拉巴卡尔、柯克·普鲁斯、阿姆农·拉波波特、罗纳德·里维斯特、露丝·罗森霍尔茨、蒂姆·拉夫加登、斯图尔特·拉塞尔、罗马·沙阿、唐纳德·舒普、史蒂文·斯基纳、丹·史密斯、保罗·斯莫伦斯基、马克·斯蒂弗斯、克里斯·斯图奇奥、米林德·坦贝、罗伯特·塔尔扬、杰夫·索普、杰克逊·托林斯、迈克尔Trick、Hal Varian、James Ware、Longhair Warrior、Steve Whittaker、Avi Wigderson、Jacob Wobbrock、Jason Wolfe 和 Peter Zijlstra。
Thank you, first, to the researchers, practitioners, and experts who made time to sit down with us and discuss their work and broader perspectives: to Dave Ackley, Steve Albert, John Anderson, Jeff Atwood, Neil Bearden, Rik Belew, Donald Berry, Avrim Blum, Laura Carstensen, Nick Chater, Stuart Cheshire, Paras Chopra, Herbert Clark, Ruth Corbin, Robert X. Cringely, Peter Denning, Raymond Dong, Elizabeth Dupuis, Joseph Dwyer, David Estlund, Christina Fang, Thomas Ferguson, Jessica Flack, James Fogarty, Jean E. Fox Tree, Robert Frank, Stuart Geman, Jim Gettys, John Gittins, Alison Gopnik, Deborah Gordon, Michael Gottlieb, Steve Hanov, Andrew Harbison, Isaac Haxton, John Hennessy, Geoff Hinton, David Hirshliefer, Jordan Ho, Tony Hoare, Kamal Jain, Chris Jones, William Jones, Leslie Kaelbling, David Karger, Richard Karp, Scott Kirkpatrick, Byron Knoll, Con Kolivas, Michael Lee, Jan Karel Lenstra, Paul Lynch, Preston McAfee, Jay McClelland, Laura Albert McLay, Paul Milgrom, Anthony Miranda, Michael Mitzenmacher, Rosemarie Nagel, Christof Neumann, Noam Nisan, Yukio Noguchi, Peter Norvig, Christos Papadimitriou, Meghan Peterson, Scott Plagenhoef, Anita Pomerantz, Balaji Prabhakar, Kirk Pruhs, Amnon Rapoport, Ronald Rivest, Ruth Rosenholtz, Tim Roughgarden, Stuart Russell, Roma Shah, Donald Shoup, Steven Skiena, Dan Smith, Paul Smolensky, Mark Steyvers, Chris Stucchio, Milind Tambe, Robert Tarjan, Geoff Thorpe, Jackson Tolins, Michael Trick, Hal Varian, James Ware, Longhair Warrior, Steve Whittaker, Avi Wigderson, Jacob Wobbrock, Jason Wolfe, and Peter Zijlstra.
感谢金县公共图书馆、西雅图公共图书馆、北部地区图书馆设施以及加州大学伯克利分校图书馆提供的后台通行证。
Thanks to the King County Public Library, the Seattle Public Library, the Northern Regional Library Facility, and the UC Berkeley libraries for backstage passes into their operations.
感谢那些与我们通信的人,他们为我们指明了值得了解的研究方向,其中包括 Sharon Goetz、Mike Jones、Tevye Krynski、Elif Kuş、Falk Lieder、Steven A. Lippman、Philip Maughan、Sam McKenzie、Harro Ranter、Darryl A. Seale、Stephen Stigler、Kevin Thomson、Peter Todd、Sara M. Watson 和 Sheldon Zedeck。
Thanks to those with whom we corresponded, who pointed us in the direction of research worth knowing, including Sharon Goetz, Mike Jones, Tevye Krynski, Elif Kuş, Falk Lieder, Steven A. Lippman, Philip Maughan, Sam McKenzie, Harro Ranter, Darryl A. Seale, Stephen Stigler, Kevin Thomson, Peter Todd, Sara M. Watson, and Sheldon Zedeck.
感谢与本文许多作者的交流,他们的交流很快让我获得了许多真知灼见,以下是他们的不完整名单:Elliot Aguilar、Ben Backus、Liat Berdugo、Dave Blei、Ben Blum、Joe Damato、Eva de Valk、Emily Drury、Peter Eckersley、Jesse Farmer、Alan Fineberg、Chrix Finne、Lucas Foglia、John Gaunt、Lee Gilman、Martin Glazier、Adam Goldstein、Sarah Greenleaf、Graff Haley、Ben Hjertmann、Greg Jensen、Henry Kaplan、Sharmin Karim、Falk Lieder、Paul Linke、Rose Linke、Tania Lombrozo、Brandon Martin-Anderson、Sam McKenzie、Elon Musk、哥伦比亚大学的 Neuwrite 小组、Hannah Newman、Abe Othman、Sue Penney、Dillon Plunkett、Kristin Pollock、Diego Pontoriero、Avi Press、Matt Richards、Annie Roach,费利西蒂·罗斯、安德斯·桑德伯格、克莱尔·施雷伯、盖尔和里克·沙利、马克斯·施隆、查理·辛普森、纳吉布·塔拉齐、乔什·特南鲍姆、彼得·托德、彼得·范韦塞普、肖恩·温、杰瑞德·维尔兹比茨基、玛雅·威尔逊和克里斯汀·杨。
Thanks to many of those with whom conversation led in short order to many of the insights herein, and of whom the following is an incomplete list: Elliot Aguilar, Ben Backus, Liat Berdugo, Dave Blei, Ben Blum, Joe Damato, Eva de Valk, Emily Drury, Peter Eckersley, Jesse Farmer, Alan Fineberg, Chrix Finne, Lucas Foglia, John Gaunt, Lee Gilman, Martin Glazier, Adam Goldstein, Sarah Greenleaf, Graff Haley, Ben Hjertmann, Greg Jensen, Henry Kaplan, Sharmin Karim, Falk Lieder, Paul Linke, Rose Linke, Tania Lombrozo, Brandon Martin-Anderson, Sam McKenzie, Elon Musk, the Neuwrite group at Columbia University, Hannah Newman, Abe Othman, Sue Penney, Dillon Plunkett, Kristin Pollock, Diego Pontoriero, Avi Press, Matt Richards, Annie Roach, Felicity Rose, Anders Sandberg, Claire Schreiber, Gayle and Rick Shanley, Max Shron, Charly Simpson, Najeeb Tarazi, Josh Tenenbaum, Peter Todd, Peter van Wesep, Shawn Wen, Jered Wierzbicki, Maja Wilson, and Kristen Young.
感谢一些优秀的免费开源软件使这项工作成为可能:首先是 Git、LaTeX、TeXShop 和 TextMate 2。
Thank you to some of the fine free and open-source software that made the work possible: Git, LaTeX, TeXShop, and TextMate 2, for starters.
感谢那些在各个方面贡献技能和努力的人:感谢 Lindsey Baggette、David Bourgin 和 Tania Lombrozo 进行书目和档案调查。
Thanks to those who lent their skills and efforts on various fronts: to Lindsey Baggette, David Bourgin, and Tania Lombrozo for bibliographic and archival sleuthing.
感谢剑桥大学图书馆允许印刷达尔文精彩的日记页面,并感谢迈克尔·兰根对其进行清晰的修复。
Thanks to the Cambridge University Library for permission to print Darwin’s wonderful diary page, and to Michael Langan for a crisp restoration thereof.
感谢亨利杨 (Henry Young) 提供的清晰肖像。
Thanks to Henry Young for a sharp portrait.
感谢所有审阅草稿并提供宝贵反馈的各位:Ben Blum、Vint Cerf、Elizabeth Christian、Randy Christian、Peter Denning、Peter Eckersley、Chrix Finne、Rick Fletcher、Adam Goldstein、Alison Gopnik、Sarah Greenleaf、Graff Haley、Greg Jensen、Charles Kemp、Raphael Lee、Rose Linke、Tania Lombrozo、Rebekah Otto、Diego Pontoriero、Daniel Reichman、Matt Richards、Phil Richerme、Melissa Riess James、Katia Savchuk、Sameer Shariff、Janet Silver、Najeeb Tarazi 和 Kevin Thomson。他们的贡献和思考,让本书更加精彩。
Thanks to those who read drafts and offered invaluable feedback along the way: to Ben Blum, Vint Cerf, Elizabeth Christian, Randy Christian, Peter Denning, Peter Eckersley, Chrix Finne, Rick Fletcher, Adam Goldstein, Alison Gopnik, Sarah Greenleaf, Graff Haley, Greg Jensen, Charles Kemp, Raphael Lee, Rose Linke, Tania Lombrozo, Rebekah Otto, Diego Pontoriero, Daniel Reichman, Matt Richards, Phil Richerme, Melissa Riess James, Katia Savchuk, Sameer Shariff, Janet Silver, Najeeb Tarazi, and Kevin Thomson. The book is immeasurably better for their saccades and thoughts.
感谢我们的经纪人马克斯·布罗克曼 (Max Brockman) 和 Brockman Inc. 团队对这项工作的敏锐和热情的支持。
Thanks to our agent, Max Brockman, and the team at Brockman Inc. for being astute and exuberant champions of the work.
感谢我们的编辑 Grigory Tovbis 和 Henry Holt 团队,感谢他们敏锐、不知疲倦、充满热情的工作,使这本书达到最佳状态,并自豪地将它推向世界。
Thanks to our editor, Grigory Tovbis, and the team at Henry Holt for their perspicacious, tireless, enthusiastic work at making the book the best it could be and for bugling it forth proudly into the world.
感谢 Tania Lombrozo、Viviana Lombrozo、Enrique Lombrozo、Judy Griffiths、Rod Griffiths 和 Julieth Moreno,他们多次承担起照顾孩子的重任,感谢 Lombrozo Griffiths 家族、加州大学伯克利分校计算认知科学实验室的成员,以及所有在因读书而导致的时间安排受限的情况下表现出优雅和耐心的人们。
Thank you to Tania Lombrozo, Viviana Lombrozo, Enrique Lombrozo, Judy Griffiths, Rod Griffiths, and Julieth Moreno, who picked up the slack on the childcare front on multiple occasions, and to the Lombrozo Griffiths family, and the members of the UC Berkeley Computational Cognitive Science lab, and to all who exhibited grace and patience with book-induced scheduling constraints.
感谢各机构提供的直接和间接支持。首先感谢加州大学伯克利分校:感谢认知与脑科学研究所访问学者项目为期两年的卓有成效的资助,以及心理学系的持续支持。感谢费城免费图书馆、加州大学伯克利分校图书馆、机械研究所图书馆和旧金山公共图书馆提供的展位和书籍。感谢宾夕法尼亚大学费舍尔美术图书馆,让一位非学生也能日复一日地从街头走进来。感谢雅多市政当局、麦克道威尔文艺营和汤森港作家会议,感谢他们提供美丽、鼓舞人心且内容丰富的驻地。感谢美国邮政媒体邮件费率,让这种四处奔波的纸墨生活成为可能。感谢认知科学学会和人工智能促进协会邀请我参加他们的年度会议,在会上我们建立了许多联系:人际、跨学科和跨半球。感谢Borderlands Cafe,它是旧金山唯一一家提供无音乐咖啡的咖啡馆。祝愿你们永远繁荣昌盛。
Thanks to the various institutions who offered direct and indirect support. Thank you first to the University of California, Berkeley: to the Visiting Scholar Program in the Institute of Cognitive and Brain Sciences for a productive two-year stint, and to the Department of Psychology for its ongoing support. Thank you to the Free Library of Philadelphia, the University of California, Berkeley Library, the Mechanics’ Institute Library, and the San Francisco Public Library for both space and tomes. Thank you to the University of Pennsylvania Fisher Fine Arts Library for allowing a nonstudent in off the streets day after day. Thank you to the Corporation of Yaddo, the MacDowell Colony, and the Port Townsend Writers’ Conference for beautiful, inspirational, and fertile residencies. Thank you to the USPS Media Mail rate for making a peripatetic ink-and-pulp lifestyle possible. Thank you to the Cognitive Science Society and the Association for the Advancement of Artificial Intelligence for invitations to attend their annual conferences, at which many connections were made: interpersonal, interdisciplinary, and interhemispheric. Thank you to Borderlands Cafe for being the one place we know in San Francisco that serves coffee without music. May you always prosper.
感谢 Rose Linke—
Thank you to Rose Linke—
感谢 Tania Lombrozo—
Thank you to Tania Lombrozo—
—作为读者、作为合作伙伴、作为支持者、作为灵感,一如既往。
—as readers, as partners, as supporters, as inspirations, as ever.
布莱恩·克里斯蒂安
ALSO BY BRIAN CHRISTIAN
最人性化的人:人工智能教会我们什么关于生存的知识
The Most Human Human: What Artificial Intelligence Teaches Us About Being Alive
澳大利亚
Australia
哈珀柯林斯出版(澳大利亚)有限公司
HarperCollins Publishers (Australia) Pty. Ltd.
伊丽莎白街201号13楼
Level 13, 201 Elizabeth Street
澳大利亚新南威尔士州悉尼 2000
Sydney, NSW 2000, Australia
http://www.harpercollins.com.au
http://www.harpercollins.com.au
加拿大
Canada
哈珀柯林斯加拿大
HarperCollins Canada
布鲁尔东街2号 - 20楼
2 Bloor Street East - 20th Floor
加拿大安大略省多伦多 M4W 1A8
Toronto, ON, M4W, 1A8, Canada
新西兰
New Zealand
哈珀柯林斯出版(新西兰)有限公司
HarperCollins Publishers (New Zealand) Limited
邮政信箱 1
P.O. Box 1
新西兰奥克兰
Auckland, New Zealand
http://www.harpercollins.co.nz
http://www.harpercollins.co.nz
英国
United Kingdom
哈珀柯林斯出版有限公司
HarperCollins Publishers Ltd.
伦敦桥街1号
1 London Bridge Street
英国伦敦 SE1 9GF
London, SE1 9GF, UK
http://www.harpercollins.co.uk
http://www.harpercollins.co.uk
美国
United States
哈珀柯林斯出版公司
HarperCollins Publishers Inc.
百老汇195号
195 Broadway
纽约州纽约市 10007
New York, NY 10007